Delete, Change, Copy Like a Wizard: The Holy Trinity of Vim Editing

Master the three most powerful editing operations in Vim. Learn to delete, change, and yank text with precision and speed that will make you feel like a coding wizard.
vim
editing
delete
change
yank
operators
Author

Hasan

Published

August 23, 2026

Modified

August 23, 2026

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

def calculate_total(items, tax_rate, discount_rate):
    # This is a long comment that needs to be removed
    total = 0
    for item in items:
        total += item.price
    return total

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

old_variable_name = calculate_something()
result = process_data(old_variable_name)

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

function processOrder(orderId, customerId, priority) {
    // function body
}

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

def calculate_tax(price, rate):
    return price * rate

def calculate_discount(price, rate):
    return price * rate

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

daw     " Delete a word (cut)
/target " Search for target location
p       " Put after cursor (paste)

2. Copy and Paste

yip     " Yank inner paragraph (copy)
}       " Jump to next paragraph
p       " Put after cursor (paste)

3. Replace Pattern

ciw     " Change inner word
" Type replacement
<Esc>   " Return to normal mode

0.8.2 Advanced Combinations

1. Swap two words

" Cursor on first word
daw     " Delete first word
w       " Move to second word
daw     " Delete second word
P       " Put second word before cursor
w       " Move forward
p       " Put first word after cursor

2. Duplicate and modify

yy      " Yank current line
p       " Put below current line
ciw     " Change first word in new line

0.9 The Dot Command: Repeat Magic

The . command repeats your last change:

Example: Changing multiple variable names

old_name = value1
old_name = value2
old_name = value3

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

  • "a to "z - Your personal storage

Examples:

"ayy    " Yank line to register 'a'
"ap     " Put from register 'a'
"byiw   " Yank word to register 'b'
"bp     " Put from register 'b'

0.10.3 System Clipboard

"+y     " Yank to system clipboard
"+p     " Put from system clipboard
"*y     " Yank to selection clipboard (Linux)
"*p     " Put from selection clipboard (Linux)

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 total

Practice these operations:

  1. Delete operations:
    • Delete the docstring: di"
    • Delete a comment: dd
    • Delete function parameter: daw
  2. Change operations:
    • Change function name: ciw
    • Change variable name: ciw
    • Change string content: ci"
  3. Yank operations:
    • Copy entire function: yip
    • Copy variable assignment: yy
    • Copy parameter list: yi(
  4. 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

ciw     " Change inner word
" Type replacement
<Esc>   " Back to normal mode

0.12.2 Pattern 2: Line Duplication and Modification

yy      " Yank current line
p       " Put below
ciw     " Change first word

0.12.3 Pattern 3: Block Movement

dip     " Delete inner paragraph
}       " Jump to target location
p       " Put paragraph

0.12.4 Pattern 4: Selective Copy-Paste

"ayy    " Yank to register 'a'
" Move to different location
"ap     " Put from register 'a'

0.13 Building Editing Muscle Memory

0.13.1 Week 1: Basic Operations

  • Practice d, c, y with simple motions
  • Use x and s for character editing
  • Master dd, cc, yy for line operations

0.13.2 Week 2: Text Objects Integration

  • Combine operators with text objects
  • Practice diw, ciw, yiw patterns
  • 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

  1. Master the trinity: Delete, change, and yank are your core tools
  2. Think verb+noun: Operators + motions/text objects = power
  3. Use text objects: ciw, di", yip are incredibly efficient
  4. Leverage registers: Named registers give you multiple clipboards
  5. 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

BibTeX citation:
@online{2026,
  author = {, Hasan},
  title = {Delete, {Change,} {Copy} {Like} a {Wizard:} {The} {Holy}
    {Trinity} of {Vim} {Editing}},
  date = {2026-08-23},
  langid = {en}
}
For attribution, please cite this work as:
Hasan. 2026. “Delete, Change, Copy Like a Wizard: The Holy Trinity of Vim Editing.” August 23.
Free email course · 7 days

Industrial Vision Foundations

AI can write the code, but someone still has to know which method fits a real inspection line. One short lesson a day for 7 days on the classical computer vision techniques that still run production systems.

Runnable code in every lesson. No spam, unsubscribe any time.

Questions, corrections or feedback?

Found a mistake, or want a topic covered next? Leave a comment below (sign in with GitHub), or write to hasanme1412@gmail.com. I read everything.