Wednesday, January 7, 2015

Re: Can I mix the use of fold-expr with fold-marker just as mixing fold-expr with fold-manual?

Thanks. Where does Vim store all my defined folds? It creates a separate buffer like NERDTree does?

On Wed, Jan 7, 2015 at 5:22 AM, Ben Fritz <fritzophrenic@gmail.com> wrote:
On Tuesday, January 6, 2015 10:16:38 PM UTC-6, Bao Niu wrote:
> Thank you very much Ben!
>
> My goal would be folding Python classes/functions automatically based on indentation, and also folding the import part at the top and some python long dict. The latter does not necessarily conform to indentation rules so marker would be ideal.
>
> The only concern about using "manual" method is once I switch to manual, can I still automatically fold up classes that are created after switching? What do pros normally do to solve this? Any hint or url would be highly appreciated. Thanks.
>
>
>


In that case, it sounds like you want to define a custom function to return a fold level, and use that as the foldexpr with foldmethod=expr.

When writing this function, the indent() function should be helpful.

Example here, plus some links and plugins: http://vim.wikia.com/wiki/Folding_for_plain_text_files_based_on_indentation

There may be better examples, that's what I could find in 5 seconds or less :-)

--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/ibbZ08p2cNg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
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/d/optout.

No comments: