Google
 

9/20/10

vim cut past; copy and past

Ever try to cut (or copy) some lines and paste to another place? If you need to count the lines first, then try these to eliminate counting task.


Cut and Paste:
1. Place the cursor at the beginning of the block you want to CUT.
2. Mark it with md
3. Go to the end of the block.
4. Cut it with d'd
5. Go to the new location that you want to PASTE those text.
Press P.

Copy and Paste:
1. Place the cursor at the beginning of the block you want to COPY.
2. Mark it with my
3. Go to the end of the block.
4. Copy it with y'y
5. Go to the new location that you want to PASTE those text.
Press P.

The name of the mark used is related to the operation (d:delete or y:yank).
I found that those mark names requires minimal movement of my finger.


Visual line mode (by shift+v):
delete by: d
Visual block mode (by ctrl + v):
delete by: c

No comments: