Search code examples
vim

Setting Vim cursorline colors?


I have tried to look at other answers here on SO and Google but none of them seem to be changing my cursor settings. I am wanting to have a background of yellow with foreground of white bold but can't get it with the settings that I have seen around the web. I am using MacVim mvim in iTerm2.

enter image description here


Solution

  • Most likely you are interested in these three highlighting groups: Cursor, CursorColumn and CursorLine. The names are self explanatory.

    For example to change just the cursor color:

    :highlight Cursor ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold
    

    To do the same for column cursor:

    :highlight CursorColumn ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold
    

    If you also need to highlight the current line, use CursorLine.