October 2012
346 pages
7h 40m
English
| Tip 29 | Duplicate or Move Lines Using ‘:t’ and ‘:m’ Commands |
The :copy command (and its shorthand :t) lets us duplicate one or more lines from one part of the document to another, while the :move command lets us place them somewhere else in the document.
For demonstration purposes, we’ll use this shopping list:
| ex_mode/shopping-list.todo | |
| Line 1 | Shopping list |
| 2 | Hardware Store |
| 3 | Buy new hammer |
| 4 | Beauty Parlor |
| 5 | Buy nail polish remover |
| 6 | Buy nails |
Our shopping list is incomplete: we also need to buy nails at the hardware store. To fix the list, we’ll reuse the last line of the file, creating a copy of it below “Hardware Store.” We can easily do so using the :copy Ex command:
| Keystrokes | Buffer Contents ... |
|---|
Read now
Unlock full access