For my current project, most work happens in tmux on a remote system. Sometimes, I would like to copy text from the remote system to my local machine (i.e. for sending email). My current workflow is
- Enter tmux copy mode and copy text
- Run
:save-buffer ~/clipboard
in tmux - On my local machine, I have a command aliased to
ssh remote-machine 'cat ~/clipboard' | pbcopy
This is a huge pain, and I'm wondering if there's a way to run a script in copy mode. Specifically, is there a way I can bind the command :save-buffer ~/clipboard
to pressing Enter in copy mode? (or maybe on buffer update?)
The machine I am ssh'ing into the remote machine from is not constant, so it's ok if I still have to run the command on my mac.