vim:autocmd: Disable relative numbers in insert

As relative line numbers are only really needed in normal mode and in
the current buffer, disable them in insert mode or when the
buffer/window is not focused.
This commit is contained in:
2022-06-17 15:06:12 +02:00
parent b2536d7c2f
commit 01ebc211bb

View File

@@ -63,3 +63,9 @@ augroup highlight_current_word
au CursorHold * :exec 'match CursorColumn /\V\<' . escape(expand('<cword>'), '/\') . '\>/' au CursorHold * :exec 'match CursorColumn /\V\<' . escape(expand('<cword>'), '/\') . '\>/'
au CursorMoved * :exec 'match' au CursorMoved * :exec 'match'
augroup END augroup END
augroup numbertoggle
au!
au BufEnter,FocusGained,InsertLeave,WinEnter * if &nu | set rnu | endif
au BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
augroup END