0

I'm using VI right now to create a php file in AWS. I wanted to know if there was any way I could paste (as in copy/paste) an array from another file into my VI on PuTTY.

The program is supposed to iterate over an array of addresses to parse them but I can't seem to figure out an efficient or easy way to upload the list of addresses.

Here's what the array looks like:

Snippet of the array

0

1 Answer 1

2

Just use Shift+Insert or right-click -> paste like you normally do? As long as vi is in 'insert' mode.

Alternatively upload the file and open it in the same vim instance (:split, :vsplit or :tabedit), y,<number of lines>,y to copy and p to paste.

To navigate between tabs type gt, between split panes use Ctrl+W,

3
  • 1
    Also the vim wiki is a good source of information, Google is your friend :)
    – ToVine
    Jun 14, 2016 at 23:40
  • the right click didn't work but the upload and split did.
    – ybordag
    Jun 14, 2016 at 23:54
  • Instead of opening the file, yanking, pasting... just do :r $file. Nov 27, 2018 at 18:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.