How to save creases in VIM when cutting and pasting?

In vim, you can create a fold with zf, so if there is%, you can carefully photograph the lock with delimiters.

  • Is there a way to select any text in visual mode and automatically reset it?

  • I noticed that if I select a closed fold and use dd to remove it, then go to another place and use P to insert it, the crease will disappear and the fold will expand. I want to cut out the folded material and paste it, and it will be inserted with the folds left and closed.

+5
source share
2 answers
  • You can do the first if you use :set foldmethod=manual, and then just select the necessary block and use z fto collapse it.
  • , ( , script)
+2

Vim ; , .

, . , script, , , , .

+1