Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toggle Cursorline on/off with one key press

Tags:

vim

At the moment I use:

map <C-F2> :set cursorcolumn<Bar>set cursorline<CR>
map <C-F3> :set nocursorcolumn<Bar>set nocursorline<CR>

How to modify the mapping to toggle on/off only by using C-F2?

like image 302
vbd Avatar asked Sep 30 '09 10:09

vbd


1 Answers

map <C-F2> :set cursorcolumn!<Bar>set cursorline!<CR>

From :help toggle

:se[t] {option}!   or
:se[t] inv{option}  Toggle option: Invert value. {not in Vi}
like image 89
rampion Avatar answered Sep 16 '22 21:09

rampion