nix-config/home/vim/plugin/numbertoggle.vim

14 lines
474 B
VimL
Raw Permalink Normal View History

2021-02-23 16:04:47 +01:00
" Idea for toggling taken from jeffkreeftmeijer
" Show line numbers
set number
augroup numbertoggle
autocmd!
" Toggle numbers between relative and absolute when changing buffers
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu | set rnu | endif
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
" Disable line numbers and relative line numbers in terminal
autocmd TermOpen * setlocal nonu nornu
augroup END