How do I copy all lines from all folds, excluding the fold titles?

  • Is ggyG not working? Commented Oct 24, 2022 at 17:17
  • 1
    From another question of you I suspect that you are using foldmethod=marker. If that is true maybe could you add that information to the question. It would be good that you tell us what is the marker you are using. I believe it would also be helpful if you could add a short example on input and the corresponding output you expect. Commented Oct 24, 2022 at 17:51

2 Answers 2


If by 'title' you mean the fold summary note that they are not copied by the yank operation.

The following sequence in normal mode will copy the content on the entire buffer:


Or if you prefer a command:


If you are folding using the foldmethod marker and your maker is {{{ then solution is to:

  1. Filter out the marker line:
  1. Copy the buffer content
  1. Undo the filtering

You can make it in one command:

:silent! g/\({{{\)\|\(}}}\)/d | %y | silent! u
  • @markling, did the solution solves your problem? Commented Oct 27, 2022 at 12:30

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.