user1592380
user1592380

Reputation: 36347

Copy from Linux command line to Vim

I want to copy an alias from my Ubuntu 14.04 command line to my .bashrc file (to make this alias always available).

I have:

ubuntu@ip-172-31-22-65:~$ alias foo='cd /home/ubuntu/projects/tp; workon env1'

I performed Ctrl + U to copy it then

ubuntu@ip-172-31-22-65:~$ vim .bashrc

However when I use "p" in Vim I see:

"Nothing in register"

How can I copy from the command line to my file?

Upvotes: 1

Views: 1216

Answers (2)

Perfortnight
Perfortnight

Reputation: 21

One of two ways:

Go into insert mode in Vim, then enter Ctrl + Shift + V.

The other way is to use the unnamed register (either * or +) and in command mode you would enter "+p or "*p. However I found that it just puts empty lines in my file (on CrunchBang Linux).

This link also describes a good mapping for Ctrl + V and ctrl + C for Vim. But there are good reasons not to overload Ctrl + C on Linux.

Upvotes: 2

nbkr
nbkr

Reputation: 131

Mark the line with the mouse and press the middle mouse button (or right mouse button if you are on Windows using SSH to access the Linux machine) to paste it. Or use "*p to paste from the system clipboard.

Upvotes: 2

Related Questions