Reply to message «Re: ctrl-o with a mapping», 
sent 23:03:53 04 February 2011, Friday
by AK:

> Well, perhaps it's not a bug that it executes only one normal mode
> command, but why would it insert the rest of the mapping into buffer?
> Is that a useful or expected behaviour under some circumstances?
Because after executing normal command it returns to insert mode.

> I would say the expected behaviour would be to run the mapping..
This is what it does now.

Original message:
> On 02/04/2011 02:50 PM, ZyX wrote:
> > Reply to message «ctrl-o with a mapping»,
> > sent 20:53:12 04 February 2011, Friday
> > 
> > by AK:
> >>    nnoremap zz zz:call LineNums()<CR>
> >> 
> >> It works well, but when I hit ctrl-O zz in insert, I get
> >> the :call .. inserted in my text. This seems like a bug in ctrl-O?
> > 
> > This is not a bug:<C-o>  executes one normal mode command and it is «zz»
> > from
> 
> Well, perhaps it's not a bug that it executes only one normal mode
> command, but why would it insert the rest of the mapping into buffer?
> Is that a useful or expected behaviour under some circumstances?
> 
> I would say the expected behaviour would be to run the mapping..
> 
>  > the mapping. What does LineNums function do? Maybe this code can be
>  > rewritten as
> 
> It refreshes screen line numbers in signs column (my linenums plugin).
> 
> [snip]
> 
> > Another suggestion:
> >      function s:WrapLineNums()
> >      
> >          normal! zz
> >          call LineNums()
> >      
> >      nnoremap
> >      nnoremap zz :call<SID>WrapLineNums()<CR>
> 
> That's great, I modified it a little bit because I have dozens
> of these commands:
> 
> function! s:WrapLineNums(cmd)
>      exe "normal! ".a:cmd
>      call LineNums()
> endfu
> nnoremap <silent> zz :call <SID>WrapLineNums("zz")<CR>
> 
> 
> Thanks!  -ak

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to