I've recently discovered I can fold blocks of code with Vim by using zf
.Then I can open and close them with zo
and zc
... I've also seen this solution on StackOverflow that has a vimrc
configuration that allows me to automatically save my folds when I close and when I open my files. However, if I copy my folded files with a cp
command like:
cp myFoldedFile.js myNewFile.js
I end up losing all my folds in myNewFile.js
. I've also tried saving it from inside Vim with :w! /home/user/myNewFile.js
but it didn't work as well. In my case, it'd work well if there was a Vim command that I could use from inside it instead of using the command line as my original sample. Is it possible? Is there any way of copying my files and keeping their folds?
foldmethod=marker
set foldmethod=marker
in myvimrc
file was enough for what I needed. Thanks!