aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFivePixels <o5pxels@gmail.com>2022-03-15 22:47:07 -0500
committerFivePixels <o5pxels@gmail.com>2022-03-15 22:49:42 -0500
commit987ad36a931b8bab1f00ba677b141f7139b8c478 (patch)
treefee442bd09f2addaa67be397bb0f24370e4ade3e
parent7c57b7e1f9b418321e522ded0448c5f4c3507713 (diff)
downloaddots-987ad36a931b8bab1f00ba677b141f7139b8c478.tar.xz
dots-987ad36a931b8bab1f00ba677b141f7139b8c478.zip
Add dynamic line number support to init.vim
-rw-r--r--.config/nvim/init.vim9
1 files changed, 8 insertions, 1 deletions
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"), '<C-v><C-m>', '
nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '<C-v><C-m>', '', 'g')<cr>p
nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR>
-
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