yank-buffer command for OSC 52

87 views
Skip to first unread message

Suraj N. Kurapati

unread,
Apr 28, 2017, 5:50:12 PM4/28/17
to tmux-...@googlegroups.com
Hello,

I think a yank-buffer command would be useful for taking an existing
tmux buffer and writing its contents out to the clipboard via OSC 52.

For instance, I sometimes need to copy the contents of an older buffer
to my system clipboard, so I run choose-buffer to interactively select
the older buffer I want to copy and then copy its contents via OSC 52:

# using https://github.com/sunaku/home/blob/master/bin/yank script
bind-key -n M-Y choose-buffer \
'run-shell "tmux save-buffer -b \"%%\" - | yank > #{pane_tty}"'

With a yank-buffer command, I could forgo the external OSC 52 logic and
simply rely on tmux's existing OSC 52 capabilities to perform the copy:

bind-key -n M-Y choose-buffer 'yank-buffer -b "%%"'

What do you think? If this seems reasonable, I can attempt a patch.

Thanks for your consideration.

Nicholas Marriott

unread,
Apr 29, 2017, 3:08:25 AM4/29/17
to Suraj N. Kurapati, tmux-...@googlegroups.com
It would be better as a flag to paste-buffer or save-buffer to write it
using OSC 52.

save-buffer is probably easier since it doesn't have a -t flag already
so you could add "-t client" to tell it which client to write to.
> --
> You received this message because you are subscribed to the Google Groups "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
> To post to this group, send an email to tmux-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages