8

I'm using heroku, and I've logged gotten access to bash using heroku run bash. I found out it was possible to install vim on heroku with this shell script:

#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin

I am now wanting to take text I yank from vim on Heroku and paste it into other editors.

To be clear, this is what I am trying to fix: I yank all the text in a file to a vim buffer (using yG for instance,) but then I want to use what I've yanked by pasting it into an application like Sublime Text I'm running locally. I've also tried "*yG. That didn't work either.

I have a vague idea why this isn't working (the buffer I'm copying to is only accessible on the server,) but isn't there someway to do this besides selecting using the terminal?

David West
  • 2,256
  • 6
  • 32
  • 62
  • I have no experience with osx, heroku either. could you try see if `gg"+yG` in vim works? your `yG` just yanks the text from your current line till the end, not "all text". also it used the `+` register (instead of `*`) – Kent May 19 '13 at 20:41
  • Try selecting lines in Visual Mode and then do :!pbcopy to pass the selected text to Mac clipboard. But since you will be running it remotely, I doubt it will work. – Spajus May 20 '13 at 05:16

1 Answers1

5

Yes, your idea is right: because Vim runs on another machine it has no access to your local clipboard or to any local command like pbcopy or pbpaste. Also, because you use Mac OS X and (I assume) iTerm.app or Terminal.app, "X forwarding" will be of no help here (you don't use X).

So, you have two options:

  • Select what you want to copy with the mouse and use your terminal emulator/system's "copy" feature.

  • Set up a complicated system where you use a remote command to scp your yanked text to your local machine where it's piped into pbcopy. I've seen things like that in the past.

But, why don't you just do your editing remotely? Or use a VCS?

romainl
  • 186,200
  • 21
  • 280
  • 313
  • 1
    thank you @romainl. I would like to link to another of your answers (http://stackoverflow.com/questions/10694516/vim-copy-mac), and to the instructions for yank to scp to pbcopy (http://endot.org/2011/12/04/remotecopy-copy-from-remote-terminals-into-your-local-clipboard/) – David West May 20 '13 at 19:18