user4726554
user4726554

Reputation:

Folding code in vim confuse me

I have a question about code folding in Vim. Let's say I open a file and fold some code, then I save it and quit. Later I open the same file, and my folds are gone. Any idea what's going on?

Upvotes: 1

Views: 89

Answers (1)

ANjaNA
ANjaNA

Reputation: 1426

You can use :mkview to save folds and such when you close a file - but you have to use :loadview next time you use the file.

Further, you can automate this with .vimrc file. Add following to your vimrc.

autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview 

Upvotes: 5

Related Questions