vim: use relativenumber and some autocmd to switch between the two
parent
0a8acba594
commit
8780a79431
18
vim/vimrc
18
vim/vimrc
|
@ -36,7 +36,7 @@ syntax enable
|
||||||
set background=dark
|
set background=dark
|
||||||
colorscheme desert
|
colorscheme desert
|
||||||
|
|
||||||
set number
|
set relativenumber
|
||||||
set showmode
|
set showmode
|
||||||
set expandtab
|
set expandtab
|
||||||
set shiftwidth=4
|
set shiftwidth=4
|
||||||
|
@ -122,6 +122,8 @@ map <F5> <ESC>:GundoToggle<CR>
|
||||||
map <F11> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
|
map <F11> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
|
||||||
" Rot13
|
" Rot13
|
||||||
map <F12> ggVGg?
|
map <F12> ggVGg?
|
||||||
|
|
||||||
|
nnoremap <silent> <leader>r :call NumberToggle()<CR>
|
||||||
" }
|
" }
|
||||||
|
|
||||||
" PLUGINS
|
" PLUGINS
|
||||||
|
@ -201,6 +203,15 @@ function! ToggleYesNo()
|
||||||
exec "normal! \"_ciw\<C-R>=w\<CR>\<Esc>b"
|
exec "normal! \"_ciw\<C-R>=w\<CR>\<Esc>b"
|
||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" NumberToggle toggles between relative and absolute line numbers
|
||||||
|
function! NumberToggle()
|
||||||
|
if(&relativenumber == 1)
|
||||||
|
set number
|
||||||
|
else
|
||||||
|
set relativenumber
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
" }
|
" }
|
||||||
|
|
||||||
" MISC
|
" MISC
|
||||||
|
@ -208,4 +219,9 @@ endfunc
|
||||||
" Every spaces/tabs at the end of line will be highlighted.
|
" Every spaces/tabs at the end of line will be highlighted.
|
||||||
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\s\+$', -1)
|
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\s\+$', -1)
|
||||||
" autocmd BufWrite * silent! %s/[\r \t]\+$//
|
" autocmd BufWrite * silent! %s/[\r \t]\+$//
|
||||||
|
|
||||||
|
autocmd WinLeave * set number
|
||||||
|
autocmd WinEnter * set relativenumber
|
||||||
|
autocmd InsertEnter * set number
|
||||||
|
autocmd InsertLeave * set relativenumber
|
||||||
" }
|
" }
|
||||||
|
|
Loading…
Reference in New Issue