Search code examples
vimcommentshighlightitalics

vimrc make comments italic


How do I change the ~/.vimrc to have the comments in my code italicized?

In my ~/.vimrc file I have:

highlight Comment ctermfg=blue

that makes the comments blue. What do I need to do differently to make them italic?


Solution

  • highlight Comment cterm=italic gui=italic
    

    You'll need a font with an italic set and a terminal capable of displaying italics. Also, if you're using a color scheme other than the default, the above line should come after the color scheme is loaded in your ~/.vimrc so that the color scheme doesn't override it.

    The cterm makes it work in the terminal and the gui is for graphical Vim clients.