In vi/vim editor, I need to copy a block. There are many ways, but one way is very quick.
label the first line by some way,
then label the end line by some way,
then put some command to copy the labeled lines.
then copy, may using 'p', but not sure.
Anybody know the commands (not yy or 10yy)? Thanks in advance.
Press d (delete) to cut, or y (yank) to copy. Move the cursor to the desired paste location. Press p to paste after the cursor, or P to paste before.
To yank one line, position the cursor anywhere on the line and type yy . Now move the cursor to the line above where you want the yanked line to be put (copied), and type p . A copy of the yanked line will appear in a new line below the cursor.
just use V to select lines or v to select chars or Ctrlv to select a block.
When the selection spans the area you'd like to copy just hit y and use p to paste it anywhere you like...
Their Documentation says:
Cut and paste:
Copy and paste is performed with the same steps except for step 4 where you would press y instead of d:
d = delete
= cut
y = yank
= copy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With