From 99a8469909a5da2557fa0c48216b3ae5556570e1 Mon Sep 17 00:00:00 2001 From: Xinqi Bao Date: Mon, 19 Oct 2026 23:09:38 +0800 Subject: [PATCH] fix(tmux): improve prompts and key handling Keep prompts on the right half of the status row so window names remain visible without reserving another row. Use Emacs prompt editing while retaining vi copy mode. Advertise tmux-256color, allow 10ms for escape sequences, restore prefix forwarding and clear-screen access, and pass navigation keys through to fzf. --- .tmux.conf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 60ca969..7af1b82 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,12 +1,12 @@ # Terminal and colors -set -g default-terminal 'xterm-256color' +set -g default-terminal 'tmux-256color' set -g set-clipboard on set -g allow-passthrough on # General settings set -g history-limit 50000 set -g mouse on -set -g escape-time 0 +set -g escape-time 10 set -g focus-events on set -g base-index 1 set -g pane-base-index 1 @@ -15,7 +15,7 @@ set -g renumber-windows off # Remap prefix from C-b to C-a unbind C-b set -g prefix C-a -bind C-a send-prefix +bind a send-prefix # Window and pane management bind c new-window -c "${HOME}" @@ -31,7 +31,6 @@ set -g status-justify left set -g status-interval 2 set -g status-style fg=colour137,bg=colour234,dim set -g status-left '' -set -g status-left-length 20 set -g status-right '#[fg=colour233,bg=colour245,bold] %H:%M #[fg=colour233,bg=colour253,bold] %m-%d ' set -g status-right-length 50 @@ -47,8 +46,8 @@ set -g pane-border-style fg=colour238,bg=colour235 set -g pane-active-border-style fg=colour51,bg=colour236 # Messages -set -g message-style fg=colour232,bg=colour166,bold -set -g message-command-style fg=blue,bg=black +set -g message-style fg=colour232,bg=colour166,bold,width=50%,align=right +set -g status-keys emacs # Clock mode set -g clock-mode-colour colour135 @@ -72,7 +71,8 @@ bind r source-file ~/.tmux.conf \; display-message "Config reloaded" # Vim-tmux-navigator: smart pane switching with vim awareness # https://github.com/christoomey/vim-tmux-navigator -is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" +bind C-l send-keys C-l +is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +([^[:space:]]+/)?g?(view|n?vim?x?|fzf)(diff)?$'" bind -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' bind -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' bind -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' -- 2.20.1