Following this great answer when trying to have italic comments in vim, I encounter a strange behaviour: I have those three relevant lines inside my .vimrc
:
set t_ZH=^[[3m
set t_ZR=^[[23m
highlight Comment cterm=italic
When I open a file with vim, comments are not displayed in italic. However, if I do :highlight Comment cterm=italic
or even :source ~/.vimrc
, I get italic comments. Any idea for possible reasons for this?
EDIT: Following the helpful answers, I solved the problem by replacing highlight Comment cterm=italic
in my .vimrc
with autocmd VimEnter * :highlight Comment cterm=italic
.
This article about scripting vim was also helpful.