O'Reilly logo

Mastering Vim by Ruslan Osipov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Types of folds

Vim is somewhat intelligent when it comes to folding code, and supports multiple ways to fold code. The folding method is guarded by a foldmethod option in your .vimrc file. Supported fold methods are as follows:

  • manual allows you to manually define folds. This becomes unrealistic when working with any substantial body of text.
  • indent supports indentation-based folding, which is perfect for languages and code bases where indentation matters (regardless of the language you're working with, a standardized code base is likely to have some consistent indentation, making indent a quick and easy way to fold away bits you don't care for).
  • expr allows for a regular-expression based folding. This is an extremely powerful tool if you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required