If you find these tutorials useful, Please consider making a donation.

Vim 9
Folding Text

Video 26 - Folding Text

In this video, we look at folding text. Folding text is just a way of hiding text when you don't need to see it.

To see which foldmethod is being used you can type :set foldmethod or the shortcut :set fdm

We using the manual foldmethod on this video.

In this video, I create a fold by selecting text using the upper case "V" to put us in visual line mode, using j or k, I select the text, then I create the fold by pressing lower case "z" then lower case "f".

To open a fold you can type lower case "z" then lower case "o"

You can close a fold by typing lower case "z" lower case "c" from any line in the folded text.

The folds will need to be saved in the directory .vim/views, and that directory may need to be created.
Placing these lines in your .vimrc file will save the folds in the .vim/views directory:
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview

Folds can be deleted pressing lower case "z" then lower case "d"