I have several highlight
commands in my .vimrc
file. In Vim 7.3, these took effect immediately after Vim had started. After updating to Vim 7.4, this is not the case anymore. Vim uses its default highlighting initially. When I load .vimrc
a second time by executing source ~/.vimrc
, highlighting works as I want.
You should be able to reproduce this problem using the following steps:
Make a copy of your
.vimrc
file.Replace
~/.vimrc
with a file that contains just the linehighlight Type ctermfg=28 cterm=bold
.Run
vim dummy.c
in a 256 color terminal (for example GNOME Terminal).Type
int
into the buffer. Theint
should appear in regular font and be colored light green, which is not what I want.Enter
:source ~/.vimrc
. Now theint
should appear in bold font and be colored dark green.
According to the article How to control/configure vim colors, it should be okay to just put the highlight
commands into .vimrc
. The article says that you should put syntax enable
after the highlight
commands, but this did not make any difference.
My first fix was to prepend each highlight
command in .vimrc
with autocmd VimEnter *
. This worked for some file types, but not for others (C files are an example).
What is the reason for this behavior? How can I have the highlight
commands executed when Vim is started such that they take effect for all buffers during the whole Vim session?
set compatible
at the beginning of.vimrc
, syntax highlighting works as expected. So this really seems to be this bug in action.highlight
commands withautocmd ColorScheme *
, which was proposed as a workaround in the bug report. It still does not work. ☹