1

TL;DR

What I Want:

JSON files to hide their double quotes (") until I enter insert mode on a line, in which event the quotes reappear. I had this behavior on another machine, but I cannot replicate it on a new install of Arch (which I'm sure is not relevant, but context)

What's happening:

Not that:

a screenshot of what I see when I open a JSON file

I see quotes.


I have the opposite complaint to this person in that I want quotes to disappear and they won't.

I do not have indentLine installed. I do have vim-polyglot installed, which, as I understand it, includes vim-json.

However, when I open a .json file, I can see quotes, still.

I tried out indentLine, but the quotes did not come back when the cursor was on their line, so I uninstalled it. Playing with conceallevel didn't help me.

My rc (updated according to @statox's suggestion):

if empty(glob('~/.vim/autoload/plug.vim'))
      silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
          \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
        autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
    endif

" :h filetype said just this was OK
filetype on
syntax enable

call plug#begin('~/.vim/plugged')

" Declare the list of plugins.
Plug 'dense-analysis/ale'
Plug 'sheerun/vim-polyglot'
Plug 'reedes/vim-colors-pencil'
call plug#end()

syntax on

colorscheme pencil
set background=dark

My vim --version reports the following:

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 23 2020 22:02:57)
Included patches: 1-814
Compiled by Arch Linux

I bet it's something really dumb, but I miss the clean look of quoteless JSON.

  • 1
    Welcome to Vi and Vim! – D. Ben Knoble Jun 14 at 13:21
  • 1
    Don't you need something like filetype plugin indent on in your vimrc before the call to plug#being? Otherwise the filetype detection is not enabled and the ftplugin which creates the concealing is not loaded, right? – statox Jun 14 at 16:37
  • @D.BenKnoble thank you!!! – hoobydooby Jun 15 at 3:44
  • @statox God knows. Let me give that a whirl. – hoobydooby Jun 15 at 3:44
  • @statox No dice, my dude :( – hoobydooby Jun 15 at 3:58
0

The actual issue is due to you simply having:

filetype on

While what you usually want is:

filetype plugin indent on

The former simply enables filetype detection, while the latter enables filetype plug-ins and indent plug-ins.

The filetype plug-in for json (ftplugin/json.vim) is the one which defaults g:vim_json_syntax_conceal to 1. You should have that plug-in run early in Vim initialization to have conceal set correctly.

| improve this answer | |
0

Turns out if I add this to the end of my rc, it works:

let g:vim_json_syntax_conceal = 1

Thank you @fibranden!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.