imsnif / vim-jsonc

Vim syntax highlighting plugin for JSON with C-style line (//) and block (/* */) comments.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON with Comments for Vim

Vim syntax highlighting plugin for JSON with C-style line (//) and block (/* */) comments.

It defines a filetype named jsonc (matching the name used in VS Code, a Microsoft parser library, .mocharc.jsonc, and the jsonc npm package) which can be applied to files using set ft=jsonc or a modeline.

Installation

This plugin can be installed in the usual ways:

Using Vim Packages

git pull https://github.com/kevinoid/vim-jsonc.git ~/.vim/pack/git-plugins/start/vim-jsonc

Using Pathogen

git pull https://github.com/kevinoid/vim-jsonc.git ~/.vim/bundle/vim-jsonc

Using Vundle

Add the following to .vimrc:

Plugin 'kevinoid/vim-jsonc'

Then run :PluginInstall.

Using vim-plug

Add the following to .vimrc between plug#begin() and plug#end():

Plug 'kevinoid/vim-jsonc'

Implementation

This plugin loads the JSON syntax plugin, clears the syntax group for comments as errors, then defines additional syntax to match C-style comments.

This project was inspired by, and the code is based on, elzr/vim-json#61 by @TheLocehiliosan.

Contributing

Contributions are appreciated! Please add tests where possible and ensure ./run-tests.sh passes.

If the desired change is large, complex, backwards-incompatible, can have significantly differing implementations, or may not be in scope for this project, opening an issue before writing the code can avoid frustration and save a lot of time and effort.

License

This package is available under the terms of the MIT License.

About

Vim syntax highlighting plugin for JSON with C-style line (//) and block (/* */) comments.

License:MIT License


Languages

Language:Vim Script 60.5%Language:Shell 39.5%