Eric Brotto
Eric Brotto

Reputation: 54251

Copy into the system clipboard from local vim on mac

It seems like versions of this question have been asked here before, but I haven't been able to glean from them the exact response to what I am looking for.

Say I open up a .txt file via vim on my mac machine and I then want to copy a line from that file to be used in another .txt file or in a google search or in terminal during an ssh session. What would be the simplest way to do this?

Thanks,


EDIT

Found a potential duplicate: Vim: copy selection to OS X clipboard. But I am open to improvements! :)

Upvotes: 0

Views: 1349

Answers (2)

darcyparker
darcyparker

Reputation: 1219

As mentioned in the other answer, use the + register or * register. In some environments, * and + may not behave as expected. To enable the expected behavior, use a plugin like fakeclip. Fakeclip enables clipboard support when it is not available out of the box.

Upvotes: 1

epsilonhalbe
epsilonhalbe

Reputation: 15967

i'm not sure wether it works for osx too but here on linux i use "+<yank>, there is also "*<yank>

see also http://vim.wikia.com/wiki/Copy_an_Entire_Buffer_to_the_Clipboard

Upvotes: 3

Related Questions