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.
This plugin can be installed in the usual ways:
Using Vim Packages
git clone https://github.com/kevinoid/vim-jsonc.git ~/.vim/pack/git-plugins/start/vim-jsonc
Using Pathogen
git clone 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'
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.
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.
This package is available under the terms of the MIT License.