From 987ad36a931b8bab1f00ba677b141f7139b8c478 Mon Sep 17 00:00:00 2001 From: FivePixels Date: Tue, 15 Mar 2022 22:47:07 -0500 Subject: Add dynamic line number support to init.vim --- .config/nvim/init.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 2ce00b1..f5ec1fd 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -10,7 +10,6 @@ nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '', ' nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '', '', 'g')p nnoremap cd :cd %:p:h:pwd - filetype plugin indent on let g:netrw_banner = 0 @@ -28,6 +27,14 @@ augroup fileExplore au VimEnter * :wincmd l augroup END +" dynamic line numbers +" insert: absolute numbers; normal: relative 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 + syntax on cnoremap sudow w !sudo tee % >/dev/null -- cgit v1.2.3