How to copy from vim to google chrome? [duplicate]

From the beginning of the file, type in the key sequence to copy the entire contents to the clipboard:

:%y+

if you want to copy just one line, move the cursor to the start of the line you want, and type in the following key sequence:

:y+

or like stated in another answer here, copy the entire contents to the clipboard + instead of the * registers try:

gg"+yG

for these key sequences to work, you need to have gvim installed, or one similar to it, that will make it so vim has the ability to copy to the clipboard. Below are 3 packages that will enable the +clipboard for vim.

sudo apt-get install vim-gnome

or

sudo apt-get install vim-athena

or

sudo apt-get install vim-gtk

I personally prefer vim-gnome but any of them should work fine.


Using a pastebin service

pastebinit -i <my_file> -b http://paste.ubuntu.com

You will see an URL. Open the URL in Chrome.