How do I navigate Vim's undo tree branches to access states that u and Ctrl-R can't reach?
g- and g+
Vim's undo history is a tree, not a linear stack.
g- and g+
Vim's undo history is a tree, not a linear stack.
:set cursorcolumn
:set cursorcolumn (or the short form set cuc) highlights the entire vertical column where the cursor sits, painting a visible strip from top to bottom of the wi
nzz
Typing nzz chains two normal-mode commands: n jumps to the next match of the last search, and zz immediately redraws the screen so the cursor line is vertically
<C-w>H and <C-w>K
After opening a split you can dynamically reposition windows using H, J, K, and L.
buffers-windows #windows #buffers-windows #navigation #normal-mode
zO and zC
zO and zC are the recursive counterparts to zo and zc.
:%s/\w\+/\u&/g
Vim's substitute command supports case-conversion modifiers in the replacement string.
[/
When editing code, you often need to navigate to the boundaries of multi-line block comments (/ .
:let @a = '...'
When a recorded macro contains a typo or needs a small tweak, you can modify it directly via the :let command rather than re-recording the entire sequence.
=ip
The =ip command combines Vim's auto-indent operator (=) with the inner paragraph text object (ip) to re-indent every line in the current paragraph in a single k
/\c
Vim lets you override the ignorecase and smartcase settings on a per-search basis using the \c (case-insensitive) and \C (case-sensitive) atoms directly inside
yiw{nav}viwp{nav}viwp
When you paste over a visual selection in Vim, the displaced text is moved into the unnamed register "".
registers #registers #visual-mode #editing #text-objects #normal-mode
{count}gt
Prefixing gt (go to next tab) with a count jumps directly to the tab page at that position.
buffers-windows #tabs #buffers-windows #navigation #normal-mode
ZZ
ZZ is a normal mode shorthand that saves and quits only if the buffer has been modified.
:let @/ = @a
Vim's search register (@/) holds the current search pattern — the same one used by n, N, *, and hlsearch highlighting.
:'<,'>norm .
The :'norm .
visual-mode #visual-mode #editing #normal-mode #repeat #dot-operator
z<CR>
While zt scrolls the current line to the top of the screen, z does the same scroll but also moves the cursor to the first non-blank character of that line.
:[range]luado {lua-expr}
Neovim's :luado command runs a Lua expression on each line of a range, allowing you to transform text using the full power of Lua's string library.
:set nrformats=
The nrformats option controls which number formats (increment) and (decrement) recognize.
:normal! {cmd}
When you use :normal {cmd} in a Vimscript function, macro, or Ex command, Vim expands any keys through the user's current mappings first.
:[range]yank {reg}
Vim's :[range]yank and :[range]delete Ex commands let you capture arbitrary line ranges into a register from the command line, bypassing the need to move the cu