Today I learned how to fold/unfold in Vim; it's quite handy.
Unexpectedly, when I exit a file and reenter it, the folds I created are gone (unfolded).
In our company's large project there are quite a lot of sticky (legacy) code blocks which are kind of obsolete but indispensable.
I really need to fold them nearly permanently.
Is there a brief way to tell Vim to save my folding preferences for a file?
:mkviewand:loadviewcommands could help. You could try adding these 2 lines inside your vimrcau BufWinLeave *.c mkviewandau BufWinEnter *.c silent loadviewand adapt them to your specific needs. These are autocommands that will be automatically executed whenever you leave a buffer for the first one, and when you enter a buffer for the second one, but only for C files. I've copied them from the help of the:mkviewcommand (:help :mkview). – saginaw Nov 16 '15 at 10:01'viewoptions'containsfolds. If you want the autocommands to be executed for other filetypes, you can change the autocommands. For example, if you want to add python files, you could change*.cto*.c,*.py. – saginaw Nov 16 '15 at 10:04