> On 10/28/11 10:21, Ben Fritz wrote:
>>
>> I find it very nice to set relative line numbers and use a count with
>> j/k for down/up movement.
>
> I know about them head-wise, and you're right about it being easier than
> keying in the absolute line#, but it's a more recent feature of vim which
> hasn't yet made it to my muscle-memory (or more importantly, my vimrc :)
>
Here's something to make it easier:
if exists('+relativenumber')
  let g:loaded_RltvNmbrPlugin='skip'
  nnoremap <expr> <C-Space> CycleLNum()
  xnoremap <expr> <C-Space> CycleLNum()
  onoremap <expr> <C-Space> CycleLNum()
  " function to cycle between normal, relative, and no line numbering
  func! CycleLNum()
    if &l:rnu
      setlocal nu
    elseif &l:nu
      setlocal nonu
    else
      setlocal rnu
    endif
    " sometimes (like in op-pending mode) the redraw doesn't happen
    " automatically
    redraw
    " do nothing, even in op-pending mode
    return ""
  endfunc
endif
This is really fun because you can cycle line numbers, relative line
numbers, and no line numbers even in op-pending mode. I sometimes do
this:
d
(Whoops, no line numbers! How many lines do I need?)
<C-Space>
6j
-- 
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
 
No comments:
Post a Comment