2

I updated from 7.4 to 8.0 last night and vim stopped honoring the highlight commands in my .vimrc file.

Minimal complete example: with a .vimrc that contains only the following

" a comment
sy enable
hi Comment ctermfg=darkCyan

the comment on line 1 is still blue when I open that file. (However when I re-source it via :so % it becomes cyan, so the file itself works).

I also tried defining a user colorscheme (and even naming it colors/default.vim) but it does not work any better.

2

Your question is similar to this one, which refers to issue #542 of Vim, where Bram suggest to use ColorScheme auto-command as the right way to customize colors:

augroup customhighlight
    autocmd!
    autocmd ColorScheme * hi Comment ctermfg=darkCyan
augroup end

Alternatively, refer to answers of that previous question for a different approach that involves making small custom colorscheme to tweak colors.

These two approaches seem to be the only reliable solutions. On multiple occasions Vim will drop all colors and reload colorscheme from the disk using g:colors_name variable to pick the file. This wipes any customizations made in vimrc unless they were in an auto-command or in the color scheme. Putting :hi commands in vimrc might make configuration dependent on the order of lines (for example, set background=dark command can drop all color customizations that precede it).

  • If so, that'd be better edited into the question (which also has the advantage of not advertising my embarrassing reading comprehension fail). ;) – Rich Nov 30 '17 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.