On 02/06/2013 04:54 PM, Ben Fritz wrote:
> On Wednesday, February 6, 2013 3:08:14 PM UTC-6, ping wrote:
>> it looks sth got break in it, at least followig doesn't work when I
>>
>> tested it manually:
>>
>>
>>
>> normal! <CR>
>>
>>
>>
>> I thought this is equivalent to hitting a return, which jumps to the
>>
>> other window , which is what will happen if I hit return myself in
>>
>> Voom
> You used a '!' at the end of your command. See :help :normal. Using a '!' says "don't use any mappings". This is a rare case where you actually need to leave it off.
thanks Ben and Marcin for pointing this out.
I understood now that this is one of the scenario that I need to retain
the origin mappings without "!" in normal.
but the problem here is, that <cr> to jump between 2 window apparently
wasn't implemented via the regular vim map, but it comes with the Voom
plugin , written in python. I guess that's why even without "!" it won't
jump with "normal <CR>". it seems only work with a manual return hit...
this makes me think that actually the vim 'normal' command is not
actually reliably reproducing what we did manually in normal mode.
so is that any good way to completely simulate a real "hit return"
exactly as what will be triggered when doing it manually?
>
> You might have another problem, because you get two window numbers, save them off, then try to jump to each in turn to close them.
yes this is what my idea was.
>
> As soon as you close the first window, all the windows potentially get renumbered.
I really didn't know this...so its a dynamic numbering then..good to learn.
> You can pull it off by always jumping to and closing the largest numbered window number first.
good ideal. that part can be fixed based on this.
function! QuitNR()
let wn_curr=winnr()
normal <CR>
let wn_pair=winnr()
let wn_larger=wn_curr > wn_pair ? wn_curr : wn_pair
let wn_smaller=wn_curr < wn_pair ? wn_curr : wn_pair
exec wn_larger . "wincmd w"
close
exec wn_smaller . "wincmd w"
close
endfu
--
--
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/groups/opt_out.
Wednesday, February 6, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment