4

Given I am SSHed into a server and have tmux running, is there any straightforward way to be able to yank into a register in vim and:

  • have that text be available in my tmux clipboard?
  • have that text available in my osx clipboard?

I know how to copy/paste in tmux and iterm2 seems to handle passing that onto my osx clipboard. However there are times when I want to yank text in a vim split screen and the tmux copy/paste won't do. Anyone figured this out?

Thanks so much!

2

2 Answers 2

1

One method would be to create a vim function that uses redir or writefile to dump the yanked register into a file, use tmux load-buffer to get it into the tmux clipboard, and then delete the file.

To get the remote tmux clipboard into the OS X clipboard, I use ssh HOST tmux show-buffer | pbcopy.

Both of these are kind of annoying, but I don't know of any better ways to do this.

1
  • Thank you. Not ideal, but I appreciate the solution! Aug 19, 2014 at 21:48
0

Part of your answer is to run tmux locally on your mac before you SSH out. Then you are working with your local tmux to copy/paste. Again, not super ideal if you need to grab more lines of code in a remote vim session that are greater in size than your current screen, but it works for most scenarios.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .