# Deleting, Yanking, and Putting

# Cut, Copy and Paste

  • d and c cut text, not just delete
  • cut = delete and save into a register
  • Register is a clipboard-like storage location

If we cut the line with dd command. This place has the cut text into what vim calls the unnamed register: default register.

unname register == default register

Use p put command to place that text one the line below where the cursor is.

ddp to swap the line xp to swap the character

p puts the text after your cursor P puts the text before your cursor

If you just want to copy text and not cut it, use the y yank. You can think yank as copy more accurately text is being yanked into a register

cut = deletel copy = yank paste = put

yw puts the text after your cursor y$ puts the text after your cursor yy copy entire line

u undo r redo

# Registers

# Types

  • Unnamed Registers
  • Numbered Registers
  • Named Registers

# Registers

Registers are preceded with a double quite.

  • Unnamed registers: ""
  • Numbered registers: "0", "1", ... "9"

Note that:

  • "" holds text from d, c, s, x and y operations
  • "0" holds last text yanked (y)
  • "1" holds last text deleted (d) or changed (c)
  • Numbered regisiters shift with each d or c

Use :ref to see show registers

# Repeating with Registers

[count][register]operator [register][count]operator

Last Updated: 12/15/2020, 10:27:30 PM