I'm used to VIM and usually I split screen with and open another file, yank the text into the second one. However I'm dealing with a legacy server which only has vi, how could I either open multiple files with it if it doesn't support split views or copy text from one file to another ( 2 separate vim instances I guess ).
I don't think this server has 'screen' enabled and I have limited access so I can't just go installing things.
The vi p and P commands "put" the line back into the file just after (p) or just before (P) the line on which the cursor is resting. Directions: Press the ESC key to be sure you are in vi Command mode. Place the cursor on the line you wish to copy.
To place the yanked line in a new line above the cursor, type P . The yy command works well with a count: to yank 11 lines, for example, just type 11yy . Eleven lines, counting down from the cursor, will be yanked, and vi indicates this with a message at the bottom of the screen: 11 lines yanked .
To copy text, place the cursor in the desired location and press the y key followed by the movement command. Below are some helpful yanking commands: yy - Yank (copy) the current line, including the newline character. 3yy - Yank (copy) three lines, starting from the line where the cursor is positioned.
open one file in Vi, yank text, then use
:e another_file
to open another file, and paste.
Assuming you are already inside a file where you have to paste text.
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