I'm using a syntax file in vim that defines a number of filetype-specific syntax keywords. To color files of this type I've also created a colorscheme file for the share directory that attempts to highlight these syntax keywords, however they don't take effect when I open files of that extension.
My color file does however highlight normal groups such as Normal
, Special
, Comment
, etc. As well, when I attempt to move these highlight commands to my .vimrc file, they still have no effect. However, after the file is loaded in vim, entering the highlight commands manually works as intended.
Is there something special I need to do in order to use syntax keywords defined in the syntax files? Do I maybe need to specify the load ordering of my syntax files & color files in my .vimrc?
EDIT: using :scriptnames
, I am able to see that my custom colorscheme file loads long before the syntax file, which in fact loads dead last. However, my .vimrc file specifies the colorscheme CustomPersonal
as the last line, far after syntax on
.
Your .vimrc
will be run when you first start Vim; the syntax file won't be applied until the file loads, and it sounds like it's overriding your settings.
Instead you could put your custom color scheme in ~/.vim/after/syntax/<filetype>.vim
instead of CustomPersonal.vim
(or at least call it from there).
Another alternative would be to add an autocmd
to your .vimrc
to source CustomPersonal.vim
in response to a suitable event.