Change tmux to support 256 colors in Ghostty and Tmux for NixOS, WSL2

(NixOS), Mac, and Asahi Fedora Remix (should in theory just work
everywhere that runs Ghostty and Tmux now)
This commit is contained in:
Martin Larsson 2025-01-02 11:46:49 +01:00
parent 6b03a3eac1
commit bcec4985b2

View file

@ -65,13 +65,30 @@ bind-key -n M-( run-shell "#{@move-pane-path} 9"
bind-key -n M-C source-file ~/.tmux.conf \; display-message "Config reloaded" bind-key -n M-C source-file ~/.tmux.conf \; display-message "Config reloaded"
# Set the default terminal to support 256 colors # Set the default terminal to support 256 colors
set -g default-terminal "alacritty" set -g default-terminal "tmux-256color"
# Enable true color support in tmux
set-option -ga terminal-features ',xterm-ghostty:RGB'
set-option -ga terminal-features ',xterm-256color:RGB'
set-option -ga terminal-features ',tmux-256color:RGB'
# Ensure tmux recognizes terminal overrides for true color
set-option -ga terminal-overrides ',xterm-ghostty:Tc'
set-option -ga terminal-overrides ',xterm-256color:Tc'
set-option -ga terminal-overrides ',*:Tc'
# Specific overrides for underline and underline colors (requires tmux >= 3.0)
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides ',*:Setulc=\E[58::2::::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
# Set the default terminal to support 256 colors
# set -g default-terminal "xterm-ghostty"
# Ensure tmux uses true color # Ensure tmux uses true color
# set-option -ga terminal-features 'xterm-256color:RGB' # set-option -ga terminal-features 'xterm-256color:RGB'
# set-option -ga terminal-overrides ',xterm-256color:Tc' # set-option -ga terminal-overrides ',xterm-256color:Tc'
set-option -ga terminal-features 'alacritty:RGB' # set-option -ga terminal-features 'xterm-ghostty:RGB'
set-option -ga terminal-overrides ',alacritty:Tc' # set-option -ga terminal-overrides ',xterm-ghostty:Tc'
# Make sure that the index of windows and panes starts at 1 # Make sure that the index of windows and panes starts at 1
set -g base-index 1 set -g base-index 1