Here's how I usually copy a block of text or code:
- Select the block with Visual mode (V) and delete it with d; or if it's just a single line, just use dd.
- Go to where I want the text to be, I am too stupid to remember the difference between p and P, so I get this right about 50% of time. (if I get it wrong: undo a try again).
- Sometimes, the indentation needs adjusting, so I go to Visual mode with V again and reselect the same block, and use > or < to fix that.
Is there an easier way? In some editors I've seen that you can "pick up" a block of text, as it were, and move it around; here's an example from Emacs (but I've also seen this in other editors):
Or perhaps there is another (even better) way?
]p
or[p
rather thanp
orP
. This way the block that you paste will be autoindented. – Gonçalo Ribeiro Feb 8 '15 at 0:28