Turn on / off the cursor line with one click

I am currently using:

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

How to change the display to turn on / off only with C-F2?

+5
source share
1 answer
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}
+7
source

All Articles