Monday, November 10, 2014

Re: Changing line numbers from normal to relative

On Sunday, November 9, 2014 11:53:38 AM UTC-6, Eric Christopherson wrote:
> On Thu, Nov 06, 2014, Ben Fritz wrote:
> >
> > if exists('+relativenumber')
> > 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 && !&l:nu
> > setlocal nu
> > elseif &l:rnu && &l:nu
> > setlocal nornu
> > elseif &l:nu && !&l:rnu
> > 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
> >
> > Thus when I hit <C-Space> in any of these modes, nothing happens, which allows me to continue with my operation, but the line numbering changes as a side effect.
>
> - the visual representation of the cursor moves to the end of the
> screen, although the actual logical cursor position in Vim isn't
> changed. Surprisingly, this affects GUI vim too.
>
> I'm using MacVim 7.4 (73), which has Vim 7.4.258 in it.
>

I've noticed this myself over the last few years I've been using the mapping. Especially this is apparent in operator-pending mode. It looks like some sort of bug in Vim. I thought I reported it before but I can't find it now.

--
--
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.

No comments: