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