Wednesday, September 22, 2010

Re: nmap'ped commands do not work - but if typed manually

Hi

fkater@googlemail.com wrote:
>
> This is probably a trivial one...
>
> I have created a new mapping similar to zO, that recursivly opens all
> folds even in case the current fold is already open (but some nested
> are not). Normal zO does not do anything in this case.
>
> I achieve this by first selecting all of the current fold (jump to
> fold end ]z, start visual mode V, jump to fold start [z), and then
> applying zO.
>
> This works when typed manually -- regardless if the cursor is inside
> an open fold or on a closed fold.
>
> However, if this command sequence is mapped
>
> nmap z<C-O> ]zV[zzO
>
> then it works only inside an open fold, not when the cursor is on a
> closed fold.

I'm not sure if it's related, but there's a note for the 'foldopen'
option that this option is not taken into account if the commands
mentioned there are used insided a mapping. One category of commands
listed at :help 'foldopen' is "block" which contains "(", "{", "[[",
"[{", etc. If "[z" falls into this category, you might try it with an
additional "zv" inside you mapping:

nmap z<C-O> ]zzvV[zzO

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

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

No comments:

Post a Comment