fix(tmux): use tmux-256color (not tmux-direct); add NO_TMUX hatch
tmux-direct as default-terminal desyncs zsh's line redraw on some terminals (iTerm2: duplicated characters on Tab, stray newlines). Switch to the standard tmux-256color and advertise truecolor per outer terminal via terminal-features (add xterm-256color:RGB alongside the foot ones). Also add a NO_TMUX escape hatch to the auto-start guard, so `NO_TMUX=1 <terminal>` opens a bare shell. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -66,9 +66,11 @@
|
|||||||
# not SSH -> don't force inbound SSH logins into a server tmux
|
# not SSH -> don't force inbound SSH logins into a server tmux
|
||||||
# not VS Code -> its integrated terminal manages itself
|
# not VS Code -> its integrated terminal manages itself
|
||||||
# tmux on PATH -> a failed exec would otherwise kill the login shell
|
# tmux on PATH -> a failed exec would otherwise kill the login shell
|
||||||
|
# $NO_TMUX unset -> escape hatch: `NO_TMUX=1 <term>` opens a bare shell
|
||||||
(lib.mkOrder 200 ''
|
(lib.mkOrder 200 ''
|
||||||
if [[ $- == *i* ]] \
|
if [[ $- == *i* ]] \
|
||||||
&& [[ -z "$TMUX" ]] \
|
&& [[ -z "$TMUX" ]] \
|
||||||
|
&& [[ -z "$NO_TMUX" ]] \
|
||||||
&& [[ -z "$SSH_CONNECTION" && -z "$SSH_TTY" ]] \
|
&& [[ -z "$SSH_CONNECTION" && -z "$SSH_TTY" ]] \
|
||||||
&& [[ "$TERM_PROGRAM" != "vscode" ]] \
|
&& [[ "$TERM_PROGRAM" != "vscode" ]] \
|
||||||
&& command -v tmux >/dev/null 2>&1; then
|
&& command -v tmux >/dev/null 2>&1; then
|
||||||
@@ -139,7 +141,11 @@
|
|||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
reverseSplit = true;
|
reverseSplit = true;
|
||||||
terminal = "tmux-direct";
|
# tmux-256color (not tmux-direct): the standard inside-tmux terminfo.
|
||||||
|
# tmux-direct's capabilities desync zsh's line redraw on some terminals
|
||||||
|
# (e.g. iTerm2 -> duplicated chars on Tab, stray newlines). Truecolor is
|
||||||
|
# advertised per outer terminal via the RGB terminal-features below.
|
||||||
|
terminal = "tmux-256color";
|
||||||
newSession = true;
|
newSession = true;
|
||||||
keyMode = "vi";
|
keyMode = "vi";
|
||||||
historyLimit = 500000;
|
historyLimit = 500000;
|
||||||
@@ -187,6 +193,10 @@
|
|||||||
bind -n M-Up select-pane -U
|
bind -n M-Up select-pane -U
|
||||||
bind -n M-Down select-pane -D
|
bind -n M-Down select-pane -D
|
||||||
|
|
||||||
|
# Truecolor for the outer terminals (foot reports xterm-ish too; iTerm2 is
|
||||||
|
# xterm-256color). Without this, with tmux-256color as default-terminal,
|
||||||
|
# 24-bit colour would be quantised to 256.
|
||||||
|
set -as terminal-features ",xterm-256color:RGB"
|
||||||
# Tell tmux which capabilities the foot terminal supports, so truecolor,
|
# Tell tmux which capabilities the foot terminal supports, so truecolor,
|
||||||
# synchronised output, the system clipboard (OSC 52), window titles and
|
# synchronised output, the system clipboard (OSC 52), window titles and
|
||||||
# cursor styling all pass through.
|
# cursor styling all pass through.
|
||||||
|
|||||||
Reference in New Issue
Block a user