Thursday, July 23, 2015

Re: Recursively open all folds within a range of lines?

On 2015-07-23 19:26, Paul wrote:
> Is there a way in vim to recursively open all folds within a range
> of lines? The zO command will open all folds in the entire file,
> but I don't want that.

Depending on whether you want to ignore or suppress error messages,
you can use

:3,15norm zO

or

:sil! 3,15norm zO

where "3,15" is the range over which you want to open folds (any
range will do: ":help :range").

If any of the lines in that range aren't part of a fold, it will give
an error message ("E490: No fold found") so prefixing it with the
"sil!" is a nice way to tell it to shut up about stuff you don't care
about.

If you do it frequently, you can make a :command or :map it.

-tim



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

Post a Comment