A reference for useful commands I use

  • Assuming vim familiarity already, this is just things that I might use
CommandFunction
General editing
0Similar to |, but can’t be paired to a motion or number modifier (50 -> 5|)
^First printable character in line. Similar to _, but can’t be paired to a motion or number modifier (5^ -> 5_)
.Repeat last change
Visual mode
gu gU ~Lowercase / Uppercase / Toggle Case
< > =Unindent, Indent, Autoindent
Wrapping
ci x”Change in” X - {}()""[]
This deletes, and lets you edit ‘in’ a section X
vi <mod>Base vim, visual mode, select in (word, line, etc)
Buffer
:bnext :bprev :bdNext, previous, delete buffer
:vsp f
:sp f
Vertical / horizontal split.
Ctrl-w w
Ctrl-w h/j/k/l
Switch window, or move to window
mini.AIAdds the a (around) and i (inside) operators
aX / iX”around X” / “inside X” selection. |“x”| vs “|x|“
g[ / g]go left/right. Move cursor to corresponding edge of a textobject
So many X, look up docsechasnovski/mini.ai
mini.surroundmini.nvim - mini-surround
saAdd surrounding. ysiw wraps word in quotes
sdDelete surroundings. ds" removes the quotes wrapping text.
srReplaces surroundings. sr([ changes parentheses to brackets
sf / sFFind surrounding to the left / right
Replacing
:x,ys/...x can be absolute (244) or relate (-4) or . (current). y is the same.
This range specifies what lines the replacement will affect.
:s/(foo)/\1barThe () group captures, and the \1 group inserts in the replacement text
\w \dRegex selectors work: word, digit, whitespace, etc.
Useful Flows
viXpJumps to inside of X, visual selects it, and replaces it with whatevers in the paste buffer
ciXJumps to X, deletes it, and places you in insert mode