6

Within vim you can fold away some data that doesn't pertain to what you're looking for at that moment. So I'd like to save that unfolded data to a separate file and look at it closer, but I don't know the correct/exact combinations to do this.

I know :folddoopen .:w >> file.ext will appended the non-folded data to an existing file, so my temporary work around is just touch file.ext before opening vi.

:folddoopen :w > file.ext won't work as this writes the entire open file to the file and even loops through it over and over and over. Doing this in my case resulted in a 4.5GB file!

I'm using vim-lite on freeBSD: https://www.freshports.org/editors/vim-lite/

By the way, is unfolded the correct term?

200_success
  • 9,549
  • 5
  • 51
  • 64

1 Answers1

8

Use a ! to force the writing, even if the file doesn't exist:

:folddoopen .:w! >> file
romainl
  • 40,486
  • 5
  • 85
  • 117