diff --git a/config/alacritty/alacritty.toml b/config/alacritty/alacritty.toml index 011182b..81b2e3e 100644 --- a/config/alacritty/alacritty.toml +++ b/config/alacritty/alacritty.toml @@ -22,3 +22,16 @@ style = "Regular" import = [ "~/.config/alacritty/themes/themes/gruvbox_dark.toml" ] + +[keyboard] +# Alacritty doesn't implement the CSI-u/Kitty keyboard protocol that lets a +# terminal report Shift+Enter as distinct from plain Enter, so it needs an +# explicit binding. Sending a raw line feed makes Shift+Enter equivalent to +# Ctrl+J, which Claude Code (and most other terminal apps) already treats +# as "insert newline" with zero further configuration -- this works +# unchanged through any depth of nested tmux, since it's just a literal +# byte rather than an escape sequence that needs to be interpreted along +# the way. +bindings = [ + { key = "Return", mods = "Shift", chars = "\n" }, +] diff --git a/config/tmux.conf b/config/tmux.conf index a87e4b9..7b44d64 100644 --- a/config/tmux.conf +++ b/config/tmux.conf @@ -58,6 +58,15 @@ bind C-y run 'tmux save-buffer - | reattach-to-user-namespace pbcopy' # 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' +# 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. +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"' + # Also make tmux's own copies (mouse-drag select in copy-mode, prefix-[ y, # etc.) reach the real system CLIPBOARD via OSC 52 -- not just PRIMARY/ # middle-click -- by declaring the "Ms" (set-clipboard) terminfo capability