Vi Tips

Cut/Copy Paste a selection which starts not at the beginning of a line

2. Press v to select block
4. Cut it with d
4. Copy it with y
6. Press P (if you want to paste before) or p (if you want to paste after).
6. If you want to paste it later press "dp (or "yp for copy) to insert it after.
Source: http://www.vim.org/tips/tip.php?tip_id=312

Cut/copy paste complete lines

Marking

You can mark any line of the editing buffer with a letter. Later you can easily return to the marked position.

Mark current line with letter b

mb
You can use any letter from a through z.

Return to the line marked by letter b

'b
Delete lines from the current position to the line marked by a

d'a
Delete the text between two marked positions a to b,

:'a,'b d
Source: http://www.apmaths.uwo.ca/~xli/vim/marking.html

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License