Any way to copy folds to a copied file?

Example: file1 has several folds, now I create a new file cp file2 newfile. newfile doesn't have folds that I had created in vim, of course it won't as cp and vim are different commands.

Any way to copy folds of file1 to newfile?

  • 2
    You might be interested in :help mkview and :help loadview
    – Zorzi
    Apr 20 '20 at 21:13
  • mkview and loadview are for saving and loading folds of one file. Here, my question is to copy fold of one file to other file.
    – mtk
    Apr 20 '20 at 21:38
  • mkview creates a file in viewdir which identifies the folds (among other things) of a specific view. What you can do is load this file from another view
    – Zorzi
    Apr 20 '20 at 21:52
  • I just recorded a quick demo: zorzi.wistia.com/medias/lyoa0jo8h4
    – Zorzi
    Apr 20 '20 at 22:05
  • 3
    cool. Thanks. Convert to answer :)
    – mtk
    Apr 20 '20 at 22:12

Your Answer

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

Browse other questions tagged or ask your own question.