Closed tversteeg closed 3 years ago
There is no autocmd event for that:
http://vimdoc.sourceforge.net/htmldoc/autocmd.html#autocmd-events
Since number toggle only toggles relative numbers, you could toggle using the F2
key by remapping it:
:nnoremap <F2> :set nornur!<CR>
FYI, I think the CmdlineEnter
and CmdlineLeave
events can be used for this now.
I achieved this with the following:
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave,CmdlineLeave,WinEnter * if &number && mode() != "i" | set relativenumber | redraw | endif
autocmd BufLeave,FocusLost,InsertEnter,CmdlineEnter,WinLeave * if &number | set norelativenumber | redraw | endif
augroup END
I would like to be able to set the numbers to absolute when I press
:
. Is this something that could be added to this plugin? I can understand it if other people don't want this option, so maybe it should be configurable?