On Friday, December 18, 2015 at 12:49:12 AM UTC-6, Igor Forca wrote:
>
>
> If I don't figure out any better idea, then I would probably use idea from some other post to map key to switch between relative to absolute numbering like:
> :nnoremap <leader>n :set relativenumber!<CR>
That won't switch all the way, because you can actually have both relativenumber and number set at the same time, showing the current (absolute) line number for the cursor line and relative numbers for every other line. But maybe that's good enough for your uses. I have a mapping to cycle through all 4 combinations, personally, and it also works in operator-pending mode:
if exists('+relativenumber')
nnoremap <silent> <expr> <C-Space> CycleLNum()
xnoremap <silent> <expr> <C-Space> CycleLNum()
onoremap <silent> <expr> <C-Space> CycleLNum()
" function to cycle between normal, relative, and no line numbering
func! CycleLNum()
if &l:rnu && !&l:nu
setlocal nu
elseif &l:rnu && &l:nu
setlocal nornu
elseif &l:nu && !&l:rnu
setlocal nonu
else
setlocal rnu
endif
" do nothing, even in op-pending mode
return ""
endfunc
endif
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment