vim Intermediate
You know the basics. Let's level up with visual mode, registers, and workflows that make vim powerful.
Visual Mode
Select text visually, then act on it.
Select and Act
- Enter visual mode (
v,V, orCtrl+v) - Move cursor to expand selection
- Act on selection:
ddelete,yyank,>indent
Block Selection (Powerful!)
Select a column of text:
This adds # to the beginning of 4 lines. Comment multiple lines instantly.
Text Objects
Act on logical units of text:
i = inner (just content), a = around (content + delimiters)
Game Changer
ci" (change inside quotes) puts you in insert mode with the quoted text deleted. Perfect for editing strings.
The Dot Command
. repeats your last change. This is huge.
Or:
Registers
vim has multiple clipboards called registers:
Useful registers:
"- default register0- last yank+- system clipboard
Marks
Bookmark positions in files:
ma " set mark 'a' at cursor
'a " jump to mark 'a'
:marks " show all marks
Lowercase marks are per-file. Uppercase marks work across files.
Multiple Files
Buffers
Split Windows
Macros
Record and replay keystrokes:
Macros Are Powerful
Record once, apply hundreds of times. Great for repetitive edits across many lines.
What does ci (change inside quotes) do in vim?
Quick Reference
| Command | Action |
|---|---|
v/V/Ctrl+v | Visual modes |
diw/daw | Delete word |
ci"/ci( | Change inside quotes/parens |
. | Repeat last change |
"ay/"ap | Register operations |
| ma / apostrophe-a | Set/jump to mark |
:split/:vsplit | Split window |
qa..q/@a | Record/play macro |
Key Takeaways
- Visual mode lets you select before acting
Ctrl+vblock select is amazing for columns- Text objects (
diw,ci") are efficient .repeats your last change- Registers give you multiple clipboards
- Macros automate repetitive edits
Next: choosing the right editor for you.