Vim: Copying and Moving Text Cheat Sheet

"{a-zA-Z0-9.%#:-"}Use register {a-zA-Z0-9.%#:-“} for next delete, yank or putUse uppercase character to append with delete and yank. {.%#:} only work with put.
:reg[isters]:di[splay]Display the contents of all numbered and named registers
:reg[isters] {arg}:di[splay] [arg]Display the contents of the numbered and named registers that are mentioned in {arg}
["x]y{motion}Yank {motion} text [into register x]
["x]yy["x]YYank [count] lines [into register x]
{Visual}["x]yYank the highlighted text [into register x]For {Visual} see Selecting Text.
{Visual}["x]YYank the highlighted lines [into register x]
:[range]y[ank] [x]Yank [range] lines [into register x]
:[range]y[ank] [x] {count}Yank {count} lines, starting with last line number in [range], [into register x]Default: current line.
["x]pPut the text [from register x] after the cursor [count] times
["x]PPut the text [from register x] before the cursor [count] times
["x]gpJust like p, but leave the cursor just after the new text
["x]gPJust like P, but leave the cursor just after the new text
:[line]pu[t] [x]Put the text [from register x] after [line]Default: current line.
:[line]pu[t]! [x]Put the text [from register x] before [line]Default: current line.

Leave a Reply

Your email address will not be published. Required fields are marked *