Archived
1
0
Fork 0

nvim: Automatically toggle between absolute and relative line numbers

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2022-12-29 16:17:23 +01:00
parent 54e2176b0a
commit 517e7560cd
Signed by: c8h4
GPG key ID: 9C82009BEEDEA0FF

View file

@ -265,6 +265,13 @@ endif
"*****************************************************************************
"" Autocmd Rules
"*****************************************************************************
"" Automatically switch between absolute and relative line numbers
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
augroup END
"" The PC is fast enough, do syntax highlight syncing from start unless 200 lines
augroup vimrc-sync-fromstart
autocmd!