Support <Shift><Enter> through multiple nested tmux's and alacritty

This commit is contained in:
2026-07-17 12:51:53 -07:00
parent aa71eebf0b
commit 1caa1be1d2
2 changed files with 22 additions and 0 deletions
+13
View File
@@ -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" },
]
+9
View File
@@ -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