Neovim folds
it is a built-in feature in Neovim; enables you to quickly navigate a long document by hiding them and opening them when you want
some keybindings for managing folds
Keymap Description zf
Create a fold. zA
Toggle a fold recursively. zM
Close all folds. zR
Open all folds. zj
Move one fold down. zk
Move one fold up. while in insert mode, there are no folds under your cursor so you can see what you type
while manually managing folds can be tedious, Neovim does have a way to automatically manage folds for you; this is dictated through the
foldmethod
variable; for more information for the following methods, seefold-${VALUE}
with the Neovim help systemwith
manual
value, no additional actions are donewith
marker
value, a fold will be created ala-HTML markerswith
expr
value, a fold will be managed through its fold level evaluated fromfoldexpr
function; certain tools like nvim-treesitter takes advantage of this to arrange the code through its blocks, scope, etc.