z in Vim
z
is one of Vim’s two junk drawers.
(The other is g
).
This is a highlight of z
command with callouts to actions available in VS Code, via VSCodeVim.
Contents
Folding
za za open a closed fold, close an open foldzA zA open a closed fold or close an open fold recursively
zc zc close a foldzC zC close folds recursively
zd zd delete a foldzD zD delete folds recursively
zE zE eliminate all folds
zf zf{motion} create a fold for Nmove textzF zF create a fold for N lines
zi zi toggle 'foldenable'zj zj 1 move to the start of the next foldzk zk 1 move to the end of the previous fold
zm zm subtract one from 'foldlevel'zM zM set 'foldlevel' to zero
zn zn reset 'foldenable'zN zN set 'foldenable'
zo zo open foldzO zO open folds recursively
zr zr add one to 'foldlevel'zR zR set 'foldlevel' to the deepest fold
zv zv open enough folds to view the cursor line
zx zx re-apply 'foldlevel' and do "zv"zX zX re-apply 'foldlevel'
Redrawing
zN<CR> z{height}<CR> redraw, make window {height} lines high
z<CR> z<CR> redraw, cursor line to top of window, cursor on first non-blankzt zt redraw, cursor line at top of window
z- z- redraw, cursor line at bottom of window, cursor on first non-blankzb zb redraw, cursor line at bottom of window
z. z. redraw, cursor line to center of window, cursor on first non-blankzz zz redraw, cursor line at center of window
Saving and Quitting
ZZ ZZ write if buffer changed and close windowZQ ZQ close window without writing
:help z
reference
==================================================================2.5 Commands starting with 'z' z
tag char note action in Normal mode------------------------------------------------------------------z<CR> z<CR> redraw, cursor line to top of window, cursor on first non-blankzN<CR> z{height}<CR> redraw, make window {height} lines highz+ z+ cursor on line N (default line below window), otherwise like "z<CR>"z- z- redraw, cursor line at bottom of window, cursor on first non-blankz. z. redraw, cursor line to center of window, cursor on first non-blankz= z= give spelling suggestionszA zA open a closed fold or close an open fold recursivelyzC zC close folds recursivelyzD zD delete folds recursivelyzE zE eliminate all foldszF zF create a fold for N lineszG zG temporarily mark word as correctly spelledzH zH when 'wrap' off scroll half a screenwidth to the rightzL zL when 'wrap' off scroll half a screenwidth to the leftzM zM set 'foldlevel' to zerozN zN set 'foldenable'zO zO open folds recursivelyzR zR set 'foldlevel' to the deepest foldzW zW temporarily mark word as incorrectly spelledzX zX re-apply 'foldlevel'z^ z^ cursor on line N (default line above window), otherwise like "z-"za za open a closed fold, close an open foldzb zb redraw, cursor line at bottom of windowzc zc close a foldzd zd delete a foldze ze when 'wrap' off scroll horizontally to position the cursor at the end (right side) of the screenzf zf{motion} create a fold for Nmove textzg zg permanently mark word as correctly spelledzh zh when 'wrap' off scroll screen N characters to the rightzi zi toggle 'foldenable'zj zj 1 move to the start of the next foldzk zk 1 move to the end of the previous foldzl zl when 'wrap' off scroll screen N characters to the leftzm zm subtract one from 'foldlevel'zn zn reset 'foldenable'zo zo open foldzp zp paste in block-mode without trailing spaceszP zP paste in block-mode without trailing spaceszr zr add one to 'foldlevel'zs zs when 'wrap' off scroll horizontally to position the cursor at the start (left side) of the screenzt zt redraw, cursor line at top of windowzuw zuw undo zwzug zug undo zgzuW zuW undo zWzuG zuG undo zGzv zv open enough folds to view the cursor linezw zw permanently mark word as incorrectly spelledzx zx re-apply 'foldlevel' and do "zv"zy zy yank without trailing spaceszz zz redraw, cursor line at center of windowz<Left> z<Left> same as "zh"z<Right> z<Right> same as "zl"
==================================================================2. Normal mode normal-index
ZZ ZZ write if buffer changed and close windowZQ ZQ close window without writing
Other
In proper vim, z
also includes commands for spelling and word wrapping.
These are ignored in this reference because they are not supported by VSCodeVim.