0

Let's say that I have a file of 100 lines, and all of the lines are folded. How would I unfold only line number 51?

  • foldmethod is manual
  • All lines were folded with 1,$fold
2
  • 1
    Running :%fold creates a single fold over the whole file. You can only open or close the fold, not parts of it. You could use smaller folds or subfolds, though.
    – D. Ben Knoble
    Dec 12, 2022 at 14:27
  • 1
    I see. So I'd have to figure out the range of the fold, unfold the whole thing, then refold the pieces above and below.
    – Tony
    Dec 13, 2022 at 2:45

2 Answers 2

1

To unfold (or open the fold) for only line 51, you would type :51 foldopen. See :help foldopen for more info.

1
  • That command unfolds all the lines. To be clear, foldmethod is manual, and all lines were folded with 1,$fold.
    – Tony
    Dec 11, 2022 at 18:59
0

zf to fold a selection. This command takes a motion after it or a previous selection.

Eg.

zfjto fold the line you're on and the one below.

or

after selecting a bunch on lines in visual mode (v) use

zf to fold the selected lines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.