0

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! :)

Community
  • 1
  • 1
Eric Brotto
  • 53,471
  • 32
  • 129
  • 174
  • 1
    `"+Y` would be the simples, look at `se clipboard=unnamed` too – sehe Jun 22 '12 at 10:12
  • 1
    possible duplicate of [vim: copy selection to OS X clipboard](http://stackoverflow.com/questions/677986/vim-copy-selection-to-os-x-clipboard) – Sarfraz Jun 25 '12 at 14:59

2 Answers2

3

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

epsilonhalbe
  • 15,637
  • 5
  • 46
  • 74
1

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.

darcyparker
  • 1,199
  • 9
  • 13