Vim
Editing as a language: operators, motions, repeats and macros.
The course
Open the courseStart at 01. The first lesson names the types. The next one builds an object. Each sample is on the page.
-
Skill
Basics
The types, explained, then an object you can name and call.
-
01
Vim from zero: the text is the data
Start here
A Vim buffer is text. w moves to the next word. On the line item latte = "oat", w from the start lands on latte.
Adds The types this course uses
-
02
Vim from zero: a text object is the thing you act on
A text object names a span of text. i" is the inside of the double quotes. di" on item latte = "oat" deletes oat and leaves the quotes.
Adds An object you can name and call
-
01
Vim from zero: the text is the data
Start here
-
Practice
Tips
A rule that prevents a bug, then a program that uses the object.
-
03
Vim from zero: an operator needs a motion
An operator does nothing until it has a motion. dw deletes from the cursor through the next word. On item latte = "oat", with the cursor on item, dw leaves latte = "oat".
Adds A tip that prevents a bug
-
04
Vim from zero: the dot command repeats the change
The dot command repeats the last change. cwadd turns the word under the cursor into add. Dot on the next order line does it again.
Adds A program that uses the object
-
03
Vim from zero: an operator needs a motion
-
Further
A whole program
One more idea, then a program that puts the pieces together.
-
05
Vim from zero: a register holds what you yanked
A yank copies text into a register. "ayi" on item latte = "oat" copies oat. "ap puts that note at the cursor. The register is the clipboard you can name.
Adds A program that puts the pieces together
-
06
Vim from zero: a global command repeats one change
:g runs a command on every line that matches. :g/^item /normal cwadd changes each order line that starts with item and a space. A note line stays.
Adds A program that puts the pieces together
-
05
Vim from zero: a register holds what you yanked
GoByte Skills: Vim track, 3 lessons. Operators and motions, the dot command and macros: editing as a language.
Open the Vim trackArticles
RSS-
Vim macros: a register full of keystrokes
GoByte Skills #27: a Vim macro is just keystrokes in a register. Record once with qa, paste it as text, edit it, yank it back, then run it on every line. The only program whose bug report reads: it did exactly what I did.
-
Vim's dot command: repeat any change
GoByte Skills #26: Vim remembers your last change as keystrokes, and . replays them at the cursor. Motions are not recorded, so shape the change to carry its own position: A, not $a. One key of automation, no YAML.
-
Vim operators and motions: a grammar
GoByte Skills #25: Vim commands are a verb plus a noun. d waits for a motion, 2w says how far, and every new motion works with every operator. Plus why cw breaks the pattern on purpose.