Similarly to plug-ins, color schemes are commonly distributed as clone-able Git repositories, which make it less desirable to directly edit their source files (as sometimes suggested) when wanting to customize their behavior.
In the case of plug-ins, Vim offers the
after-directory mechanism, which allows personal preferences to overrule or add to the distributed defaults or system-wide settings. For example,
~/.vim/after/ftplugin/fortran.vim, if it exists, will automatically be read following the distributed
fortran.vim while files in
after/plugin/ may be used in a similar way to customize individual plug-ins.
Unfortunately, this behaviour isn't supported for
colors/ as documented:
'runtimepath'for the file
The first one that is found is loaded.
Given that color schemes may be dynamically re-loaded (e.g. after setting
'background'), simply patching it in
.vimrc once it has been loaded is not enough. Furthermore, this does not scale well when managing many color schemes.
The documentation for
To customize a colorscheme use another name, e.g.
~/.vim/colors/mine.vim, and use
:runtimeto load the original colorscheme:
runtime colors/evening.vim hi Statement ctermfg=Blue guifg=Blue
However, this is inconsistent with and seems less transparent than what is
described above (e.g. requiring another name). So, How can I can obtain
the automatic behavior of
after-directory for color schemes?
- How do I customize vimdiff colors?
- Why do custom highlights in my vimrc get cleared or reset to default?
- vim 8.0 not honoring custom colors