Friday, August 16, 2013

Re: Automatically open fold with in normal mode?

Hi,

Reckoner wrote:
>
> I'm using vim 7.3 on windows 8.
>
> Is there a way to setup a normal mode mapping where if I hit <enter> on a folded section, it will open that section (as in zO). The trick is that I only want that mapping to work *while on a folded line* and not otherwise map <enter> elsewhere.
>
> Possible?

use the following mapping:

nnoremap <expr> <cr> foldclosed(line('.')) == -1 ? "\<cr>" : "zO"

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

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

No comments: