vimcommentsitalics

How to make comments Italic in gVim?


I am fairly new to Vim and mainly use gVim for most of my coding purposes. I am trying to figure out what to add in my _vimrc (in windows) to make my comments italic.

I tried adding

highlight Comment cterm=italic

but that didn't work. My modifications so far in my vimrc (if it matters) is:

color slate
set number
set nowrap
set guioptions+=b
if has('gui_running')
  set guifont=Consolas:h10
endif

So what can I do so that my comments appear in italics (consolas, italic, size 10)?


Solution

  • The cterm definition is only for high color terminals; for the GUI, you need to use the gui= argument:

    highlight Comment cterm=italic gui=italic
    

    Also, put this after the :colorscheme command in your ~/.vimrc, or else it might get overridden.