From b3e28acfb6a594ded680d2db772855044c03b166 Mon Sep 17 00:00:00 2001 From: Rezinas Date: Mon, 17 Apr 2017 10:14:56 -0700 Subject: [PATCH] add function to toggle line numbers on and off --- .vimrc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.vimrc b/.vimrc index 0c5fe32..c1d91ce 100644 --- a/.vimrc +++ b/.vimrc @@ -53,7 +53,8 @@ nnoremap ev :vsp $MYVIMRC nnoremap et :exec ":vsp /Users/dblack/notes/vim/" . strftime('%m-%d-%y') . ".md" nnoremap ez :vsp ~/.zshrc nnoremap sv :source $MYVIMRC -nnoremap l :call ToggleNumber() +nnoremap l :call ToggleRelativeNumber() +nnoremap tl :call ToggleNumber() nnoremap :noh nnoremap s :mksession nnoremap a :Ag @@ -128,7 +129,7 @@ let g:airline_right_sep = '' let g:airline_right_sep = '' " }}} " Custom Functions {{{ -function! ToggleNumber() +function! ToggleRelativeNumber() if(&relativenumber == 1) set norelativenumber set number @@ -137,6 +138,13 @@ function! ToggleNumber() endif endfunc +function! ToggleNumber() + if(&relativenumber == 1) + set norelativenumber + endif + set invnumber +endfunc + " strips trailing whitespace at the end of files. this " is called on buffer write in the autogroup above. function! StripTrailingWhitespaces()