Closed lervag closed 10 years ago
I just noticed another related thing: Thematic breaks plugins that alter highlighting such as vim-niji. The reason seems to be the same as what I mentioned above.
Perhaps a better approach here would be to add some hooks after a theme has been loaded. Something like this:
let g:thematic#themes.theme.post_hook = 'MyFunction'
Where MyFunction
is a function that is called after the theme has been loaded, and where I can make my customizations as desired.
Colorscheme initialization can be a tricky problem, as you observe. :)
Thematic will alter colors typically upon demand, much as if the user typed :colo solarized
, which also will not re-initialize the customized highlights you had specified in your .vimrc
. A configurable post-load hook sounds like one way to address that, perhaps on a per-theme basis.
Better yet you can set up your own event-driven hook:
augroup MyCustomHighlights
autocmd!
autocmd colorscheme *
\ highlight SpellBad gui=bold guibg=#faa |
\ highlight SpellCap gui=bold guibg=#faf |
\ highlight SpellRare gui=bold guibg=#aff |
\ highlight SpellLocal gui=bold guibg=#ffa
augroup END
Regarding plugins like vim-niji that will override the highlighting, that's a more difficult problem. Ideally they should re-initialize after a user typed :colo solarized
, but at least that plugin does not. I'd ask its author to do an event-driven hook as above to re-initialize themselves.
Does that answer your concerns/questions?
Yes, thank you!
Hi. I've just begun testing your plugin, which seems convenient. However, I found that it "breaks" custom highlighting from my
vimrc
file, since the colorschemes and syntax plugins are loaded later than usual.I don't see an immediate fix for this. That is, one possibility would be to add a functionality to add customizations to Thematic. For instance, I have the following customized highlights:
Perhaps you could implement something like this:
Where the custom highlighting is activated after a theme has been loaded?