Try this please (although if your terminal supports OSC 52 you could
just put Ms in terminal-overrides and turn on set-clipboard).
diff --git a/window-copy.c b/window-copy.c
index 542c28a..965583a 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -1480,18 +1480,28 @@ void
window_copy_copy_pipe(struct window_pane *wp, struct session *sess,
const char *bufname, const char *arg)
{
- void *buf;
- size_t len;
- struct job *job;
-
+ void *buf;
+ size_t len;
+ struct job *job;
+ struct format_tree *ft;
+ char *expanded;
buf = window_copy_get_selection(wp, &len);
if (buf == NULL)
return;
- job = job_run(arg, sess, NULL, NULL, NULL);
+ ft = format_create();
+ format_window_pane(ft, wp);
+ if (sess != NULL)
+ format_session(ft, sess);
+ expanded = format_expand(ft, arg);
+
+ job = job_run(expanded, sess, NULL, NULL, NULL);
bufferevent_write(job->event, buf, len);
+ free(expanded);
+ format_free(ft);
+
window_copy_copy_buffer(wp, bufname, buf, len);
}
On Tue, Nov 04, 2014 at 05:41:09PM -0800, Suraj N. Kurapati wrote:
> 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
>
> ------------------------------------------------------------------------------
> _______________________________________________
> tmux-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users