I've added:
set number
nnoremap <F2>:set nonumber!
to my vimrc file. Basically what it's supposed to do is let me press to toggle line numbering but it's not working. What have I done wrong?
Thanks in advance :)
I've added:
set number
nnoremap <F2>:set nonumber!
to my vimrc file. Basically what it's supposed to do is let me press to toggle line numbering but it's not working. What have I done wrong?
Thanks in advance :)
In your .vimrc, try :
set number
nnoremap <F2> :set nonumber!<CR>
This will toggle line numbering while you press F2.
This is what I use (with a different key binding):
nmap <f2> :set number! number?<cr>
The "number!" toggles the setting and "number?" reports the state.
This is one method:
map <silent> <F2> :if &number <Bar>
\set nonumber <Bar>
\else <Bar>
\set number <Bar>
\endif<cr>
(this one is nice 'cause I usually put foldcolumn in there as well)
This is another:
map <silent> <F2> :set invnumber<cr>
(direct method)