Template:TipImported Instead of keeping zc and zo in your head, just use za to toggle a fold open or closed.

If you open a file or change a fold method, and everything in your file is folded, use zR to "reveal" all of it by opening all folds.

Try setting foldmethod=syntax. Many syntax files define folding based on the language syntax, although you may need to enable it by setting syntax file options. If a specific syntax file doesn't define folding, you can define your own or see below.

Map [{V%zf (or even zfa{ which is easier) to some key sequence (I use <leader><leader>) to fold the current code block (in languages which use {,} as block delimiters).

Use folds liberally. If you fold every function, when you open the file, you will be presented with a quick reference of what functions are defined in the file.

Don't nest too many folds, it grows to be a pain if you use more than two levels of nested folds.

If you think you need more than two levels of folds, you probably need to refactor your code.




Community content is available under CC-BY-SA unless otherwise noted.