diff --git a/config/tmux.conf b/config/tmux.conf index e564573..f413156 100644 --- a/config/tmux.conf +++ b/config/tmux.conf @@ -60,15 +60,20 @@ bind C-y run 'tmux save-buffer - | $HOME/dotfiles/bin/clipboard-copy' # option, so only set it when the running tmux is new enough. if-shell "tmux -V | awk '{print $2}' | awk -F. '{if ($1*1000+$2 >= 3003) exit 0; else exit 1}'" 'set -g allow-passthrough on' -# Deliberately OFF, do not re-enable: extended-keys makes tmux re-encode raw -# control-equivalent bytes (Tab, CR, Backspace, Escape, and LF/Ctrl-J) into -# CSI 27;;~ sequences instead of passing the plain byte through, -# any time it doesn't recognize the data as bracketed paste. Turning this on -# previously mangled every LF byte -- both literal Ctrl+J keypresses and -# every newline in pasted text -- into that unrecognized CSI sequence before -# it reached the app in the pane, breaking Ctrl+J-as-newline and corrupting -# multi-line pastes with literal escape-sequence garbage. -set -s extended-keys off +# Let tmux tell Shift+Enter apart from plain Enter and forward that +# distinction inward, so Claude Code's Shift+Enter-inserts-newline shortcut +# works. extended-keys/terminal-features need tmux >= 3.2. The terminal +# name is matched with '*' rather than the commonly-suggested 'xterm*', +# because a nested tmux's "terminal" is the outer tmux, which reports +# itself using default-terminal above (screen-256color) -- 'xterm*' would +# never match that, breaking the nested case this is meant to support. +# +# Investigated as a suspect for multi-line paste getting corrupted with +# literal CSI 27;;~ garbage in place of newlines (see Claude Code +# issues #43169 and #30239) -- turning this off did not fix that paste +# corruption, so it's an upstream Claude Code paste-tokenizer bug, not +# something caused by this setting. Restored. +if-shell "tmux -V | awk '{print $2}' | awk -F. '{if ($1*1000+$2 >= 3002) exit 0; else exit 1}'" 'set -s extended-keys on; set -as terminal-features "*:extkeys"' # Accept pane-originated OSC 52 clipboard-set attempts into a real tmux # buffer. Only on-vs-off matters here -- off would refuse to even look at