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:47:07 -0500
commitcc520cb40e5495c3a464e8a8288d4b17ff8d8d2b (patch)
treeca3a2995c43d185d6f973c53a8f2a3cc5bbc5440
parent8eb8f0ae632e2fb7629b3ccbb33c2b831308d5e9 (diff)
downloaddots-cc520cb40e5495c3a464e8a8288d4b17ff8d8d2b.tar.xz
dots-cc520cb40e5495c3a464e8a8288d4b17ff8d8d2b.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