Vim has a concept of folding, which squashes multiple real lines into one visual line on the screen, which is primarily used for expanding and collapsing blocks of code. I'd like to reuse these keybindings in iamb (see ulyssa/iamb#93), so I'm going to add a FoldAction that the following keys can map to:
zf - create a fold over motion or visual selection
zd - remove a single fold at cursor or w/in visual selection
zD - remove folds recursively at cursor or w/in visual selection
zE - remove all folds w/in the window (need to figure out if this means viewport or buffer)
zo - open fold under the cursor; count impacts depth; in visual mode one level is open for all line in the selection
zO - open all folds under the cursor recursively; in visual mode open all folds w/in selection
zc - close one fold under the cursor; count impacts depth; in visual mode one level is closed for all liens w/in selection
zC - close all folds under the cursor recursively;
za - toggle folds under cursor between open/closed count times
zA - toggle folds under cursor between open/closed recursively
zv - open enough folds to make cursor line visible
zx - restore all manually opened and closed folds to original state, and then expand folds for cursor line until cursor is visible, like zv
zX - restore all manually opened and closed folds to original state
zm - reduce folding level by count; enable folding if not already enabled
zM - close all folds by setting folding level to 0; enable folding if not already enabled.
zr - increase folding level by count
zR - open all folds by setting folding level to highest value
zn - disable folding in buffer
zN - enable folding in buffer
zi - toggle folding in buffer
There are also the following movement keys, which will need a new variant in MoveType:
[z - move to start of currently open fold
]z - move to end of currently open fold
zj - move downwards to the start of the next fold (also mapped in Operator-Pending Mode)
zk - move upwards to the end of the previous fold (also mapped in Operator-Pending Mode)
Vim has a concept of folding, which squashes multiple real lines into one visual line on the screen, which is primarily used for expanding and collapsing blocks of code. I'd like to reuse these keybindings in iamb (see ulyssa/iamb#93), so I'm going to add a
FoldAction
that the following keys can map to:zf
- create a fold over motion or visual selectionzd
- remove a single fold at cursor or w/in visual selectionzD
- remove folds recursively at cursor or w/in visual selectionzE
- remove all folds w/in the window (need to figure out if this means viewport or buffer)zo
- open fold under the cursor; count impacts depth; in visual mode one level is open for all line in the selectionzO
- open all folds under the cursor recursively; in visual mode open all folds w/in selectionzc
- close one fold under the cursor; count impacts depth; in visual mode one level is closed for all liens w/in selectionzC
- close all folds under the cursor recursively;za
- toggle folds under cursor between open/closed count timeszA
- toggle folds under cursor between open/closed recursivelyzv
- open enough folds to make cursor line visiblezx
- restore all manually opened and closed folds to original state, and then expand folds for cursor line until cursor is visible, like zvzX
- restore all manually opened and closed folds to original statezm
- reduce folding level by count; enable folding if not already enabledzM
- close all folds by setting folding level to 0; enable folding if not already enabled.zr
- increase folding level by countzR
- open all folds by setting folding level to highest valuezn
- disable folding in bufferzN
- enable folding in bufferzi
- toggle folding in bufferThere are also the following movement keys, which will need a new variant in
MoveType
:[z
- move to start of currently open fold]z
- move to end of currently open foldzj
- move downwards to the start of the next fold (also mapped in Operator-Pending Mode)zk
- move upwards to the end of the previous fold (also mapped in Operator-Pending Mode)