Tuesday, August 27, 2013

Re: Question about folding methods


On Aug 28, 2013 12:01 AM, "Niels Kobschätzki" <niels@kobschaetzki.net> wrote:
>
> Hi,
>
> I have a question about folding methods. Out of my head there are 3: syntax, indent, manual.

You missed diff, marker and expr.

> When I set the mode to one of the "automatic" ones (syntax, indent), it doesn't seem that I can zf anymore. I tried to switch to manual (:set foldmethod=manual), set the fold manually and then switch back to indent but then my manual fold got opened again.
> Is there any way to be in indent mode because then I can easily use "zc" and also use "zf" when I want to fold outside the indentations?

You can remap zf to use custom function and emulate any behavior you need with fdm=expr. I guess you will have to rely on something like markers or signs to achieve what you want since simply recording first and last lines in a custom function and use this data within foldexpr will not work as when lines are added/removed simple records become invalid. Sign and markers position gets adjusted in this case though.

> Is there a faster way to switch between folding methods than ":set foldmethod=<method>"?

As usual, you should create a custom mapping.

>
> Niels

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

Post a Comment