Published on

zM zR in Neovim

In Vim (and Neovim), zM and zR are folding commands:

  • zMClose all folds (maximum fold level)
  • zROpen all folds (reduce fold level to zero)

These commands are useful when dealing with large files where sections are folded for better readability. If you use folding based on syntax, indent, or manual marks, zM can collapse everything to give a high-level view, and zR can expand everything to show the full content.