Vim guides
Each guide answers one question, and the answer comes first. Every example is checked in Vim.
- ciwccddxChange and delete words and linesChange a word in Vim with ciw, delete a word with daw, and change or delete a line with cc or dd. There's a worked example and the cases that surprise people.
- iwi"i(apText objectsVim text objects pick a word, a quoted string, brackets, a paragraph or an HTML element by its shape. Use them with c, d and y from anywhere inside.
- yyyiwpPCopy and paste with yank and putIn Vim, y copies (yanks) and p pastes (puts). Copy a line with yy, a word with yiw, move a line with dd and p, and learn where p puts the text.
- uCtrl-rUndo and redoPress u to undo and Ctrl-r to redo in Vim. See what counts as one change, how counts work, and why moving the cursor is never undone.
- /?n*SearchSearch in Vim with / and ?, move between matches with n and N, and find the word under the cursor with *. There's also f and t for one line.
- :%sFind and replace with :sFind and replace in Vim with :s/old/new/. Replace on one line or the whole file with :%s, ask before each change with c, and match whole words.
- qaq@a@@Record and replay macrosRecord a macro in Vim with qa, stop with q, and replay it with @a, @@ or a count like 5@a. Make it work on every line, and edit it as text.
- .cgnqa@aRepeat a change with the dotThe dot command repeats your last change in Vim. Make one change, move, and press the dot. See how to make changes that repeat well, and when to use a macro.
- vVCtrl-vSelect text in Visual modeSelect text in Vim with v, whole lines with V, and a column with Ctrl-v. Then delete, copy or change the selection, or type on every line at once.
- w$G3wCounts and motionsVim motions move the cursor by words, lines and characters. Add a count to repeat them, and an operator to act on the text they cover.
- "ayy"0p"_dRegistersVim registers hold copied and deleted text. Copy into a named register with "ayy, keep a copy safe with "0p and "_d, and see where macros live.
How the feedback works
Read how your keys are counted and when you're shown a shorter route. The article's examples are run in this site's editor when the site is built.