If you are using vim as editor and you are using vim inside a pseudo-terminal such as PuTTY, you might have less trouble with copy and paste function as you can use your mouse to highlight text, copy, and paste it inside the file.
However, if you have difficulty copying multiple lines in vim without access to mouse, or in tty, you might want to utilize the command ‘v’ or ‘V’.
To yank (copy) multiple lines:
1) Place the cursor on the first position of the first line you want to yank.
2) In vim command mode, press ‘v’ (without the quotes). You will notice that the message “– VISUAL –” will appear on the lower left part of the screen. This is an indicator that you are now in ‘Visual’ mode.
3) Use your arrow keys to move the cursor to highlight the lines of texts you want to manipulate.
4) After highlighting, press the ‘y’ key to yank (copy) the highlighted lines. You will notice the message similar to “9 lines yanked” on the lower left side of the screen. This means you have successfully copied the lines and ready to be pasted!
5) Place your cursor on the line you want to insert your copied lines to and press ‘p’ to paste below the cursor, or ‘P’ to paste above the cursor.
If you would rather cut the lines, press ‘d’ instead of ‘y’.
Subscribe to Email Feeds
- Vim: How to Copy Multiple Lines
- Required Packages for Oracle 11gR2 on Red Hat Enterprise Linux 6
- How Replace Space with Newline in Vim
- 3ix Web Hosting Complaints | First Time WebHosting on Backspace Key Not Working in PuTTY
- 3ix Web Hosting Complaints | First WebHosting on Backspace Key Not Working in PuTTY
- Cheap Web Hosting 3ix | Best in Webhosting on Cebu Pacific Sucks
- 3ix Web Hosting | Best in Webhosting on See Actual Street Pictures with Google Street
- 3ix Web Hosting Complaints – Raw Ask on Cebu Pacific Sucks