Suraj N. Kurapati
2014-11-05 01:41:09 UTC
Hello,
I'm trying to use copy-pipe with my yank[1] script to copy the
selection to my system clipboard via the OSC 52 escape sequence.
But in order for this to work, the escape sequence needs to be
written *directly* to the terminal device that has tmux attached.
I tried the following copy-mode key bindings, but nothing worked:
bind-key -t vi-copy y copy-pipe 'yank'
bind-key -t vi-copy y copy-pipe 'yank > /dev/tty'
bind-key -t vi-copy y copy-pipe 'yank > #{pane_tty}'
bind-key -t vi-copy y copy-pipe 'tmux run-shell "yank > #{pane_tty}"'
In contrast, writing to #{pane_tty} works in normal key bindings:
# transfer most-recently copied text to attached terminal with yank:
bind-key -n M-y run-shell 'tmux save-buffer - | yank > #{pane_tty}'
# transfer previously copied text (chosen from a menu) to attached terminal:
bind-key -n M-Y choose-buffer 'run-shell "tmux save-buffer -b \"%%\" - | yank > #{pane_tty}"'
How can I interpolate the correct #{pane_tty} value into copy-pipe?
Thanks for your consideration.
[1]: https://github.com/sunaku/home/blob/master/bin/yank
------------------------------------------------------------------------------
I'm trying to use copy-pipe with my yank[1] script to copy the
selection to my system clipboard via the OSC 52 escape sequence.
But in order for this to work, the escape sequence needs to be
written *directly* to the terminal device that has tmux attached.
I tried the following copy-mode key bindings, but nothing worked:
bind-key -t vi-copy y copy-pipe 'yank'
bind-key -t vi-copy y copy-pipe 'yank > /dev/tty'
bind-key -t vi-copy y copy-pipe 'yank > #{pane_tty}'
bind-key -t vi-copy y copy-pipe 'tmux run-shell "yank > #{pane_tty}"'
In contrast, writing to #{pane_tty} works in normal key bindings:
# transfer most-recently copied text to attached terminal with yank:
bind-key -n M-y run-shell 'tmux save-buffer - | yank > #{pane_tty}'
# transfer previously copied text (chosen from a menu) to attached terminal:
bind-key -n M-Y choose-buffer 'run-shell "tmux save-buffer -b \"%%\" - | yank > #{pane_tty}"'
How can I interpolate the correct #{pane_tty} value into copy-pipe?
Thanks for your consideration.
[1]: https://github.com/sunaku/home/blob/master/bin/yank
------------------------------------------------------------------------------