Original title was «Language-specific color-schemes prevent simpler ones from coloring certain language-specific tags»
I'm using gVim 7.3 (on Ubuntu 12.04 Arch x86/64, for that matters).
UPDATE (2013-03-02):
I think I can finally express exactly what I mean (I still couldn't find the correct command, assuming it even exists!). Basically this is the flow:
- start session with a small footprint colorscheme which defines few basic groups (like Statement, Comment, Function);
- switch to a "larger" colorscheme (like Solarized or Jellybeans), which defines more specific groups (like vimCommand, hsImport or rubyBeginEnd). These more specific groups override basic ones;
- switch back to a "smaller" colorscheme (one which doesn't define specific groups).
The result is that the session is cluttered with "homeless" group that obscure the basic ones and prevent some words to be highlighted at all. These homeless groups look like the following:
INPUT :hi vimCommand
Enter
OUTPUT vimCommand xxx cleared
By the way something similar is experienced and issued in the Solarized's github issue tracker → Vim colorscheme leaves a wake of destruction when switching away
UPDATE (2012-11-25):
Probably, a good solution would be clearing the current session's "highlight" variables (I'm not talking about variables like smartindent
, encoding
, number
, but rather about variables like Statement
, Comment
rubyClass
, xmlTag
, i.e. the ones defined by commands like hi link ...
, highlight ...
, etc.).
If anyone could explain how it is stored in memory, it could maybe help me figuring out how to clean it away (I've tried saving a session through :mksession mysession.vim
and then looking into it, but there's no trace of any syntax highlighting variable).
Also, and this is just a vague supposition, it seems that the reason why :hi clear
doesn't clean up the highlight groups is that the "leftovers" were defined through an indirect definition (e.g. hi link
).
Original:
When my default colorscheme (a modified version of blueshift) is loaded every tag that should be highlighted is correctly coloured.
During the session, I switch to jellybeans colorscheme (:colo jellybeans
), which has many more options than my default color-scheme:
If I switch again to my default colorscheme (:colo blueshifted
), some highlighting is disabled:
It seems that at the beginning of the session if I use a color-scheme that doesn't specify the behaviour for some language-specific tags, those tags are auto-coloured using some existing colors.
I know that jellybeans's language-specific tags remain in the "cache" and are the responsible for disabling the auto-coloring feature, because if I switch between colorschemes that don't have language-specific tags (without ever using jellybeans), the auto-coloring isn't ruined.
The same happens with other color-schemes (for example railscasts.vim uses HTML-specific coloring). I know I can solve the issue by adding the missing tags in the less-specific color-scheme, but I'm looking for a more general solution.
The Questions
what can I do to avoid that these auto-setting colors (used when the first color-scheme is loaded) are disabled when a less detailed color-scheme is loaded after a more-detailed color-scheme?
Can I clean up the session cache (i.e. remove the specific tags used by jellybeans.vim from the "session cache") when I change color-scheme?
My attempts These are the commands I used in various combination, to no avail:
:syntax off
:syntax clear
:hi clear
:syntax reset
The only thing that works (obviously!) is redefining by hand the hi link
commands missing in the "simple" colorscheme. But of course this is no different by using the other colorscheme (like Solarized) with changed colors. Of course this is not a solution to the question "How do you remove highlighting groups leftovers?".
hi clear
should take care of it but I suspect it is has to do withset background=light
vsset background=dark
. Does it happen when you switch to and from a light colorscheme? – Scarlattihi clear
. I tried setting a dark (non-detailed) color-scheme as default, and switching with jellybeans, but the auto-coloring is ruined in this case too. – Emalia