Tuesday, July 6, 2021

Re: Pre-fold output of :r! command

On 2021-07-06 17:59, Julius Hamilton wrote:
> If I unfold that fold, I think the fold disappears. I then have to
> respecify the content to be folded. Or if not, I still have to put
> my cursor on the top line of the fold, to re-fold it.

Unless you delete the fold, it should remain even after you expand it.
You can see a visualization of your folds by setting some appropriate
value (roughly how many fold-levels you expect to nest) to
'foldcolumn' such as

:set foldcolumn=4

> I would prefer to just have a go to button to fold and unfold what
> was printed, no matter where in the document I am.

You can use

za

to toggle folds under the cursor, or

zR

to expand all folds in the entire file and

zM

to collapse all folds in the file. There's also

zX

to reset all open/closed folds so that they return to 'foldlevel'

And of course, there's

zo
zO

to expand ("open" is my mnemonic) one/all folds under the cursor and

zc
zC

to close all folds under the cursor. If you start reading around

:help zo

there are a lot of commands for opening/closing and jumping between
folds that should get you what you need.

> What would be the most convenient way to refold a large section of
> text after having unfolded it?

Usually

zC

should do this for the section containing the cursor, or

zM

for all folds everywhere.

-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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210706114849.6913039a%40bigbox.attlocal.net.

No comments:

Post a Comment