0.1 The Wizard’s Toolkit
Imagine you’re a wizard with three magical spells that can transform any text:
- Delete Spell: Makes unwanted text vanish instantly
- Change Spell: Transforms text into something new
- Copy Spell: Duplicates text wherever you need it
These are Vim’s three fundamental editing operations. Master these, and you’ll edit text faster than you ever thought possible.
0.2 The Holy Trinity
0.2.1 1. Delete (d) - The Vanishing Act 🗑️
What it does: Removes text and stores it in a register Think of it as: A magic eraser that remembers what it erased
0.2.2 2. Change (c) - The Transformer 🔄
What it does: Deletes text and immediately enters Insert mode Think of it as: Delete + Insert in one smooth motion
0.2.3 3. Yank (y) - The Duplicator 📋
What it does: Copies text to a register without removing it Think of it as: A photocopy machine for text
0.3 The Grammar Pattern
Remember the verb+noun pattern? These are your verbs:
[count] + operator + motion/text-object
Examples: - d3w = Delete 3 words - c2l = Change 2 characters - yap = Yank around paragraph
0.4 Delete Mastery: Making Text Disappear
0.4.1 Basic Delete Commands
| Command | What It Deletes | Story |
|---|---|---|
x |
Character under cursor | “x marks the spot to delete” |
X |
Character before cursor | “X deletes backward” |
dd |
Entire line | “delete double = whole line” |
dw |
Word from cursor | “delete word” |
db |
Word backward | “delete back” |
d$ |
To end of line | “delete to $ (end)” |
d0 |
To beginning of line | “delete to 0 (start)” |
0.4.2 Advanced Delete Patterns
| Command | What It Deletes | Example |
|---|---|---|
daw |
A word (with space) | hello from “hello world” |
diw |
Inner word | hello from “hello world” |
di" |
Inside quotes | text from "text" |
da" |
Around quotes | "text" including quotes |
dip |
Inner paragraph | Paragraph without empty lines |
dap |
Around paragraph | Paragraph with empty lines |
0.4.3 Practical Delete Examples
Example 1: Cleaning up a function
Tasks: 1. Delete the comment: Move to comment line, dd 2. Remove discount_rate parameter: Move to it, daw 3. Delete inside function: Move to function body, di{
0.5 Change Mastery: The Ultimate Transformer
0.5.1 Basic Change Commands
| Command | What It Changes | Story |
|---|---|---|
cc |
Entire line | “change complete line” |
cw |
Word from cursor | “change word” |
cb |
Word backward | “change back” |
c$ |
To end of line | “change to $ (end)” |
c0 |
To beginning of line | “change to 0 (start)” |
C |
From cursor to end of line | “Change to end (shortcut)” |
0.5.2 Advanced Change Patterns
| Command | What It Changes | Example |
|---|---|---|
ciw |
Inner word | Replace hello in “hello world” |
caw |
A word (with space) | Replace hello in “hello world” |
ci" |
Inside quotes | Replace content in "text" |
ca" |
Around quotes | Replace "text" entirely |
cip |
Inner paragraph | Replace paragraph content |
ci( |
Inside parentheses | Replace x + y in (x + y) |
0.5.3 Practical Change Examples
Example 1: Refactoring variable names
Tasks: 1. Change variable name: Move to old_variable_name, ciw, type new_name 2. Change function name: Move to calculate_something, ciw, type compute_value 3. Change string content: Move inside quotes, ci", type new content
Example 2: Updating function parameters
Task: Change priority to urgencyLevel 1. Move to priority 2. ciw (change inner word) 3. Type urgencyLevel
0.6 Yank Mastery: The Copy Champion
0.6.1 Basic Yank Commands
| Command | What It Yanks | Story |
|---|---|---|
yy |
Entire line | “yank yank = whole line” |
yw |
Word from cursor | “yank word” |
yb |
Word backward | “yank back” |
y$ |
To end of line | “yank to $ (end)” |
y0 |
To beginning of line | “yank to 0 (start)” |
0.6.2 Advanced Yank Patterns
| Command | What It Yanks | Example |
|---|---|---|
yiw |
Inner word | Copy hello from “hello world” |
yaw |
A word (with space) | Copy hello from “hello world” |
yi" |
Inside quotes | Copy content from "text" |
ya" |
Around quotes | Copy "text" with quotes |
yip |
Inner paragraph | Copy paragraph content |
yi( |
Inside parentheses | Copy x + y from (x + y) |
0.6.3 Practical Yank Examples
Example 1: Duplicating code blocks
Task: Copy the calculation logic 1. Move to price * rate 2. yiw to copy just price, or 3. y$ to copy price * rate, or 4. yy to copy entire line
0.7 The Put Command: Completing the Circle
After yanking or deleting, you need to put (paste) the text:
| Command | What It Does | Story |
|---|---|---|
p |
Put after cursor | “put after” |
P |
Put before cursor | “Put before” |
gp |
Put after and move cursor | “go put” |
gP |
Put before and move cursor | “go Put before” |
0.7.1 Put in Action
Example: Moving a line down 1. dd - Delete current line 2. j - Move down one line 3. p - Put the line after current position
Example: Duplicating a word 1. yiw - Yank inner word 2. w - Move to next word 3. p - Put the word after cursor
0.8 Combining Operations: The Power Combos
0.8.1 The Classic Workflows
1. Cut and Paste
2. Copy and Paste
3. Replace Pattern
0.8.2 Advanced Combinations
1. Swap two words
2. Duplicate and modify
0.9 The Dot Command: Repeat Magic
The . command repeats your last change:
Example: Changing multiple variable names
Workflow: 1. Move to first old_name 2. ciw and type new_name 3. Press Esc 4. Move to next old_name 5. Press . to repeat the change 6. Repeat steps 4-5 for remaining occurrences
0.10 Registers: The Advanced Storage System
Vim has multiple clipboards called registers:
0.10.1 Default Registers
"- Default register (last delete/yank)0- Yank register (last yank only)1-9- Delete registers (recent deletes)
0.10.2 Named Registers
"ato"z- Your personal storage
Examples:
0.10.3 System Clipboard
0.11 Practice Exercise: The Editing Dojo
Create a file with this content:
def calculate_price(item_price, tax_rate, discount_rate):
"""Calculate final price with tax and discount."""
# First apply discount
discounted_price = item_price * (1 - discount_rate)
# Then apply tax
final_price = discounted_price * (1 + tax_rate)
return final_price
def process_order(order_data):
"""Process customer order."""
total = 0
for item in order_data:
price = calculate_price(item.price, 0.08, 0.10)
total += price
return totalPractice these operations:
- Delete operations:
- Delete the docstring:
di" - Delete a comment:
dd - Delete function parameter:
daw
- Delete the docstring:
- Change operations:
- Change function name:
ciw - Change variable name:
ciw - Change string content:
ci"
- Change function name:
- Yank operations:
- Copy entire function:
yip - Copy variable assignment:
yy - Copy parameter list:
yi(
- Copy entire function:
- Advanced workflows:
- Duplicate a line and modify it
- Move a line to different location
- Replace multiple occurrences with
.
0.12 Common Editing Patterns
0.12.1 Pattern 1: Quick Word Replacement
0.12.2 Pattern 2: Line Duplication and Modification
0.12.3 Pattern 3: Block Movement
0.12.4 Pattern 4: Selective Copy-Paste
0.13 Building Editing Muscle Memory
0.13.1 Week 1: Basic Operations
- Practice
d,c,ywith simple motions - Use
xandsfor character editing - Master
dd,cc,yyfor line operations
0.13.2 Week 2: Text Objects Integration
- Combine operators with text objects
- Practice
diw,ciw,yiwpatterns - Use quote and bracket objects
0.13.3 Week 3: Advanced Workflows
- Practice cut/copy/paste workflows
- Use named registers for complex operations
- Master the dot command for repetition
0.13.4 Week 4: Speed and Efficiency
- Develop personal editing patterns
- Combine with movement commands
- Practice real-world editing scenarios
0.14 What’s Next?
You now master: - The three fundamental editing operations (delete, change, yank) - How to combine operators with motions and text objects - The put command for pasting text - Registers for advanced text storage - The dot command for repetition - Common editing patterns and workflows
In the next post, we’ll explore Visual Mode: See What You’re Doing and learn how to select and transform text with visual feedback.
0.15 Key Takeaways
- Master the trinity: Delete, change, and yank are your core tools
- Think verb+noun: Operators + motions/text objects = power
- Use text objects:
ciw,di",yipare incredibly efficient - Leverage registers: Named registers give you multiple clipboards
- Practice the dot command: Repetition is key to efficiency
The holy trinity of Vim editing transforms you from a character-by-character editor to a text structure manipulator. Once these operations become muscle memory, you’ll edit at the speed of thought.
Ready to see your edits before you make them? Continue with Visual Mode: See What You’re Doing to master visual selection and transformation.
Reuse
Citation
@online{2026,
author = {, Hasan},
title = {Delete, {Change,} {Copy} {Like} a {Wizard:} {The} {Holy}
{Trinity} of {Vim} {Editing}},
date = {2026-08-23},
langid = {en}
}