From a62e4f0339e9cebd31941010968553778db6341b Mon Sep 17 00:00:00 2001 From: bretello Date: Fri, 28 Nov 2025 10:50:16 +0100 Subject: [PATCH] feat(clipboard): tmux: send clipboard to client when using clipcopy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From `man tmux`: ``` load-buffer [-w] [-b buffer-name] [-t target-client] path (alias: loadb) Load the contents of the specified paste buffer from path. If -w is given, the buffer is also sent to the clipboard for target-client using the xterm(1) escape sequence, if possible. If path is ‘-’, the contents are read from stdin. ``` By adding '-w', we can get `load-buffer` (and `clipcopy`) to also send the copied buffer to the client, allowing for easy copying tmux buffers into the local client, which is useful in scenarios such as ssh+tmux remote sessions. --- lib/clipboard.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 5d149f056..27e81525a 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -82,7 +82,7 @@ function detect-clipboard() { function clipcopy() { cat "${1:-/dev/stdin}" | termux-clipboard-set; } function clippaste() { termux-clipboard-get; } elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then - function clipcopy() { tmux load-buffer "${1:--}"; } + function clipcopy() { tmux load-buffer -w "${1:--}"; } function clippaste() { tmux save-buffer -; } else function _retry_clipboard_detection_or_fail() {