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 
the mapping. What does LineNums function do? Maybe this code can be rewritten as

    function s:WrapLineNums()
        call LineNums()
        return "zz"
    endfunction
    nnoremap <expr> zz <SID>WrapLineNums()
(Note that it changes the order of operation: LineNums appear before «zz»).

Another suggestion:

    function s:WrapLineNums()
        normal! zz
        call LineNums()
    nnoremap
    nnoremap zz :call <SID>WrapLineNums()<CR>

Original message:
> I have a mapping that looks like this:
> 
>   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?
> Using vim 7.3..
> 
>   -ak

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

Reply via email to