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?


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

:folddoopen .:w! >> file
  • That did it! I don't have enough of a reputation to up vote, but I've marked it as the answer. Jun 14 '15 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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