This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/range-commands-with-relative-numbering-jason-draper
Jason Draper helps you streamline by using range commands with relative numbering.
How did Jason get the actual line number to show on the current line when in relative number mode, rather than just 0? Looks useful!
set relativenumber set number
.vimrc to get relative line numbers and the current line number.
I have this in my
.vimrc file to toggle between the two:
function! NumberToggle() if(&relativenumber ==1) set norelativenumber set number else set relativenumber set number endif endfunction nnoremap <leader>n :call NumberToggle()<cr>
It works alright.
Ah cool, thanks guys!
@DavidVII, if you have vim-unimpaired, you can also use the plugins toggles,
con for toggling numbering and
cor to toggle relative number.