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.
Asked
Active
Viewed 3.4k times
20
-
possible duplicate of [VIM Highlight the whole current line](http://stackoverflow.com/questions/8750792/vim-highlight-the-whole-current-line) – Jeff B Mar 20 '15 at 14:01
-
Not a duplicate. @pertrai1 is already using the options, as can be seen on the screenthot. – svlasov Mar 20 '15 at 14:13
-
1@JeffBridgman - No, if you look at my screenshot I already have those set that are answered in the possible duplicate – pertrai1 Mar 21 '15 at 15:40
-
Sorry for the misunderstanding. – Jeff B Mar 21 '15 at 16:02
2 Answers
24
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
.

pdoherty926
- 9,895
- 4
- 37
- 68

svlasov
- 9,923
- 2
- 38
- 39
-
1sorry for the beginner part of me asking this question: how would I set this in my .vimrc file? When i did it in normal mode it worked great, but I want it to stay like that all the time. Thank you for bearing with me on this. – pertrai1 Mar 20 '15 at 13:47
-
4
10
If you wants to keep it enable always put the below things in your .vimrc or .gvimrc file
for cursorline
set cursorline
autocmd InsertEnter * highlight CursorLine guibg=#000050 guifg=fg
autocmd InsertLeave * highlight CursorLine guibg=#004000 guifg=fg
for cursor column
set cursorcolumn
autocmd InsertEnter * highlight CursorColumn ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold
autocmd InsertLeave * highlight CursorColumn ctermfg=Black ctermbg=Yellow cterm=bold guifg=Black guibg=yellow gui=NONE
You can change the colors in your wish

imbichie
- 1,510
- 3
- 13
- 23