diff --git a/lyrathorpe/home/shell.nix b/lyrathorpe/home/shell.nix index 83e4396..8d4bd9f 100644 --- a/lyrathorpe/home/shell.nix +++ b/lyrathorpe/home/shell.nix @@ -66,9 +66,11 @@ # not SSH -> don't force inbound SSH logins into a server tmux # not VS Code -> its integrated terminal manages itself # tmux on PATH -> a failed exec would otherwise kill the login shell + # $NO_TMUX unset -> escape hatch: `NO_TMUX=1 ` opens a bare shell (lib.mkOrder 200 '' if [[ $- == *i* ]] \ && [[ -z "$TMUX" ]] \ + && [[ -z "$NO_TMUX" ]] \ && [[ -z "$SSH_CONNECTION" && -z "$SSH_TTY" ]] \ && [[ "$TERM_PROGRAM" != "vscode" ]] \ && command -v tmux >/dev/null 2>&1; then @@ -139,7 +141,11 @@ programs.tmux = { enable = 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; keyMode = "vi"; historyLimit = 500000; @@ -187,6 +193,10 @@ bind -n M-Up select-pane -U 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, # synchronised output, the system clipboard (OSC 52), window titles and # cursor styling all pass through.