1

rephrased my question based on Matt's answer and Christian's comment:

I really like the indentLine plugin that shows vertical lines to visualize indentation levels. However, when using it, it does not only replace white spaces with according characters to visualize lines, but in addition removes characters like quotes in a .json file.

I realized this when ending up here. Based on the plugins Readme stating

You can customize these settings, but the plugin will not function if conceallevel is not set to 1 or 2.

Since the plugin sets conceallevel to 2, I tried to set it to 1 (Thanks to the answer of @Matt, I now understand that 0 can't work), but quotes are still missing in json files.

This answer does only work for tabs, not for spaces.

The vim-indent-guides plugin that is pointed to in this answer is nice but colors spaces and does not add lines.

So I'm looking for the functionality that the indentLine plugin provides, but without removing or hiding characters other than prefixed white spaces.

7
  • 3
    for the filetype where you do not want to have concealing enabled, configure Vim to disable syntax file concealing, e.g. for json, :let g:vim_json_conceal=0, see also :h ft-<filetype>-syntax, e.g. :h ft-json-syntax Dec 2 '20 at 13:03
  • @ChristianBrabandt Do I understand it right that with e.g. :let g:vim_json_conceal=0, I switch off conceal support based on the json syntax file, but still keep conceal support for the indentLine plugin to work. Following from that, I would have to make sure that a possibly existing syntax file based conceal support for all filetypes I use is switched off.
    – Wolfson
    Dec 2 '20 at 16:34
  • I just don't understand. So even if you've set cole=1... what do you expect? How on earth could the quotes appear? Have you read :h 'cole' at all?
    – Matt
    Dec 2 '20 at 17:10
  • Ok, I had to read much more than only the :h cole part (that I've read before) in order to get enough context. I guess I do understand it now. Based on :let g:vim_json_conceal=0 I prevent the region matched based on surrounding " to be concealed by means of leaving out the concealends (in /usr/share/vim/vim82/syntax/json.vim line 23 & 34 in my version). @Matt: :h concealends.
    – Wolfson
    Dec 2 '20 at 18:08
  • @ChristianBrabandt if you put your comment into an answer I'll accept it.
    – Wolfson
    Dec 2 '20 at 18:12
2

Vim runs in (virtual) terminal, thus it's not allowed to combine arbitrary pixels over existing glyphs. The "conceal" feature is supposed to be used for displaying one character instead of another actually stored in memory buffer.

To repeat it again: indentation bar here is a different character (U+00A6 or whatever), not a bunch of pixels drawn on top of space (U+0020).

So your question is basically read as "how do I do conceal without conceal?" what makes no sense to me.

If you don't like conceal'd syntax for json files you can explicitly disable it with

let g:vim_json_conceal = 0

as @ChristianBrabandt suggested in the comments.

1
  • Thanks for your answer that clarifies some basics I didn't know about. I should rephrase my question to not sound like making no sense. It's basically about getting the vertical indentation lines by only replacing spaces and without loosing characters like a " in a json.
    – Wolfson
    Dec 2 '20 at 16:07

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.