[UPDATE][VIM] Number toggle without a plug-in
It's really just a few lines of really simple Vimscript.
This commit is contained in:
parent
a7bdded5c6
commit
c9a2b25a2c
11
vim/.vim/plugin/numbertoggle.vim
Normal file
11
vim/.vim/plugin/numbertoggle.vim
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
" 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
|
||||||
|
augroup END
|
|
@ -101,8 +101,6 @@ Plug 'rust-lang/rust.vim'
|
||||||
|
|
||||||
" Vim facilities enhancement {{{
|
" Vim facilities enhancement {{{
|
||||||
""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""
|
||||||
" Relative numbers only on focused buffer
|
|
||||||
Plug 'jeffkreeftmeijer/vim-numbertoggle'
|
|
||||||
" A better netrw
|
" A better netrw
|
||||||
Plug 'tpope/vim-vinegar'
|
Plug 'tpope/vim-vinegar'
|
||||||
" Better quick-fix window
|
" Better quick-fix window
|
||||||
|
@ -154,8 +152,6 @@ autocmd FileType netrw setlocal bufhidden=delete
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" Set the minimal amount of lignes under and above the cursor for context
|
" Set the minimal amount of lignes under and above the cursor for context
|
||||||
set scrolloff=5
|
set scrolloff=5
|
||||||
" Show line number (needed for number toggle)
|
|
||||||
set number
|
|
||||||
" Always show status line
|
" Always show status line
|
||||||
set laststatus=2
|
set laststatus=2
|
||||||
" Enable Doxygen highlighting
|
" Enable Doxygen highlighting
|
||||||
|
|
Loading…
Reference in a new issue