Skip to content

Instantly share code, notes, and snippets.

@phil
Created July 3, 2012 10:40
Show Gist options
  • Select an option

  • Save phil/3038973 to your computer and use it in GitHub Desktop.

Select an option

Save phil/3038973 to your computer and use it in GitHub Desktop.
Vim Number/RelativeNumber mode switching
" Autocmds to switch number mode based on Vim Mode
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
" function switch number mode
function! ToggleLineNumbers()
if &number == 1
set relativenumber
else
set number
end
endfunction
" key mapping for quick number mode switching
map <leader>; :call ToggleLineNumbers()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment