Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim Conceal highlight

When using vim's conceal feature set cole=2, vim conceal the appropriate text for whatever is configured in cchar, and highlight it using Conceal group.

My problem is that I use the conceal feature in c/c++ to replace operations like && ||, etc for unicode ⋀ ⋁ etc, and I also use concel in html to replace text entities like "ç" to "ç".

So I have in ~/.vim/after/syntax/c.vim

hi clear Conceal

and in ~/.vim/after/syntax/html.vim

hi Conceal cterm=NONE ctermbg=NONE ctermfg=darkblue

The problem is that this settings are global. If I open a c file, and then I open a html file, when I get back to the c file the Conceal group is highlighted as per the last buffer opened.

My question is: Can I set the Conceal group to be used to something different than Conceal? If not, how can I make the highlights specific to the current buffer (and not globally) ?

like image 364
Akobold Avatar asked Feb 25 '13 16:02

Akobold


1 Answers

You can't. Well, you can set up :autocmds to toggle the Conceal group's highlighting depending on the current buffer, but it would still be off for non-active visible buffers of the other type. In general, highlight groups are global, and that is unlikely to change.

To solve your dilemma, I would choose one highlighting for Conceal that is both unobtrusive enough for your C/C++ use, yet visually distinct to show the replaced HTML entities. To me, completely clearing the Conceal highlighting is not an intended use; it should always serve as a reminder that what you see is not what's actually in the text.

like image 126
Ingo Karkat Avatar answered Oct 25 '22 02:10

Ingo Karkat