Skip to main content
3 of 3
added 381 characters in body
jth
  • 133
  • 3

Comment highlight group does not work without reloading .vimrc

The following line in my ~/.vimrc:

hi Comment ctermfg=gray

does not take effect unless I start Vim and then use :source to reload .vimrc. As far as I can tell, all of the other hi commands work without reloading .vimrc. What could be causing this?

This is my full .vimrc:

filetype indent plugin on                                                       
syntax on                                                                       
                                                                                
set number                                                                      
set relativenumber                                                              
                                                                                
set colorcolumn=80                                                              
                                                                                
set showcmd                                                                     
                                                                                
set expandtab                                                                   
set shiftwidth=4                                                                
set smarttab                                                                    
                                                                                
set list                                                                        
set listchars=tab:>-,trail:~                                                    
                                                                                
hi ColorColumn ctermbg=0                                                        
hi LineNr ctermfg=gray                                                          
hi CursorLineNr ctermfg=gray                                                    
hi Comment ctermfg=gray                                                         
hi Function ctermfg=darkgreen                                                   
                                                                                
hi pythonStatement ctermfg=lightblue                                            
hi pythonConditional ctermfg=lightblue                                          
hi pythonRepeat ctermfg=lightblue                                               
hi pythonException ctermfg=lightblue                                            
hi pythonDecoratorName ctermfg=lightblue                                        
let python_no_number_highlight = 1                                                                                                               

Edit: The output of :verbose hi Comment is:

Comment        xxx term=bold ctermfg=14 guifg=#80a0ff
        Last set from /usr/share/vim/vim80/syntax/syncolor.vim

So it appears that my setting is being overridden by the default syntax file. I will investigate how to solve this when I have time, but would appreciate any tips from more experienced users :)

jth
  • 133
  • 3