From bcec4985b22da3e70e645df3006ed37ed9f75215 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 2 Jan 2025 11:46:49 +0100 Subject: [PATCH] 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) --- home/.tmux.conf | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/home/.tmux.conf b/home/.tmux.conf index 6ab3636..1e1f26d 100644 --- a/home/.tmux.conf +++ b/home/.tmux.conf @@ -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" # 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 # set-option -ga terminal-features 'xterm-256color:RGB' # set-option -ga terminal-overrides ',xterm-256color:Tc' -set-option -ga terminal-features 'alacritty:RGB' -set-option -ga terminal-overrides ',alacritty:Tc' +# set-option -ga terminal-features 'xterm-ghostty:RGB' +# set-option -ga terminal-overrides ',xterm-ghostty:Tc' # Make sure that the index of windows and panes starts at 1 set -g base-index 1