-
-
Save rgo/21687935a9bda2827e227e92855a3c7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:EnableRelativeNumber() | |
set nonumber | |
set relativenumber | |
endfunction | |
function! s:DisableRelativeNumber() | |
set norelativenumber | |
set number | |
endfunction | |
function! s:ToggleRelativeNumber() | |
if &relativenumber == 1 | |
call <SID>DisableRelativeNumber() | |
else | |
call <SID>EnableRelativeNumber() | |
endif | |
endfunction | |
autocmd InsertEnter * :call <SID>DisableRelativeNumber() | |
autocmd InsertLeave * :call <SID>EnableRelativeNumber() | |
nmap <silent> <leader>nl :call <SID>ToggleRelativeNumber()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment