Training plan › Editing
Copy and paste
yy, p, P and the line-swap trick.
Copying in Vim is called yank: yy copies the line, yw a word, y + motion whatever you want. Paste is p (after) or P (before). Deleting also “copies”: what you remove with dd or x goes to the same place, so ddp swaps two lines.
5 steps · 4 min · 60 XP
- Copy and paste a line: yyp
- Paste above: P
- Swap lines: ddp
- Copy a word and replace another
- Paste several times: 3p