Vim displays json file without any quotes

I have a validated json file that will display without any quotes in Vim. The only time it displays the json file correctly is under Visual mode.

I have tried disabling eslint, jshint, youcompleteme

MacVim 7.4
Vim 7.4 in Terminal

enter image description here

enter image description here

The built-in $VIMRUNTIME/syntax/json.vim uses Vim’s conceal feature to hide the quotes, presumably to remove unnecessary clutter.

You must have enabled concealing by setting the 'conceallevel' option to 2 or 3; the default is 0 (off). Likewise, you see the quotes in visual mode because of your 'concealcursor' setting.

Inside a JSON file, check where the conceal options got set:

:verbose set conceallevel? concealcursor?

Then, you can adapt your settings to suit your preferences.

Adding to the currently accepted answer, you can disable that behavior specifically for JSON by setting the following option in you .vimrc:

" Disable quote concealing in JSON files
let g:vim_json_conceal=0

That way, you don’t have to set conceallevel to 0 (disabled), which would also make useful plugins like indentLine (which was mentioned in a comment above) not work anymore.

Like already mentioned, one can check which plugin caused the increased conceal level:

:verbose set conceallevel?

If the conceal level is caused by the vim-json Plugin:

let g:vim_json_syntax_conceal = 0

If conceal is caused by the indentLine Plugin:

let g:indentLine_setConceal = 0

In vimrc, You can add both options for json files:

autocmd Filetype json
  \ let g:indentLine_setConceal = 0 |
  \ let g:vim_json_syntax_conceal = 0

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Similar Posts