From 919ea1656bbd8c056346dc55ba66de4a9f686217 Mon Sep 17 00:00:00 2001 From: Ryota Ikezawa Date: Mon, 16 Feb 2026 10:38:18 +0900 Subject: [PATCH] fix(tmux): use native OSC 52 for SSH clipboard instead of manual base64 pipe The manual base64 | xargs printf pipeline broke clipboard copy on remote tmux sessions because Linux base64 wraps at 76 chars, causing xargs to generate multiple incomplete OSC 52 sequences. Additionally, /dev/tty may not be available in tmux server's daemonized copy-pipe subprocess. Replace with copy-selection-and-cancel and rely on tmux's native OSC 52 mechanism (set-clipboard external + terminal-features clipboard) which handles encoding and delivery correctly. --- dot_tmux.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dot_tmux.conf b/dot_tmux.conf index 089571a..574f87d 100644 --- a/dot_tmux.conf +++ b/dot_tmux.conf @@ -63,14 +63,14 @@ bind -T copy-mode-vi v send -X begin-selection # Clipboard integration: # - Local (macOS): use pbcopy directly for reliable clipboard access -# - Remote (SSH): use OSC 52 escape sequence to copy through terminal +# - Remote (SSH): rely on tmux native OSC 52 via set-clipboard external + terminal-features if-shell '[ -z "$SSH_TTY" ]' \ 'bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"; \ bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "pbcopy"' if-shell '[ -n "$SSH_TTY" ]' \ - 'bind -T copy-mode-vi y send -X copy-pipe-and-cancel "base64 | xargs -I {} printf \"\\033]52;c;%s\\007\" {} > /dev/tty"; \ - bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "base64 | xargs -I {} printf \"\\033]52;c;%s\\007\" {} > /dev/tty"' + 'bind -T copy-mode-vi y send -X copy-selection-and-cancel; \ + bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel' # OSC 52 / passthrough settings (required for nested tmux over SSH) # Local (outer) tmux: set-clipboard on (processes OSC 52 and forwards to terminal)