diff --git a/dot_config/tmux/tmux.conf b/dot_config/tmux/tmux.conf new file mode 100644 index 0000000..148074b --- /dev/null +++ b/dot_config/tmux/tmux.conf @@ -0,0 +1,41 @@ +# --- 1. 核心体验优化 --- +set -g mouse on # 开启鼠标支持:点击换面板、滚轮翻日志、拖动改分屏大小 +set -g base-index 1 # 窗口编号从 1 开始(对应键盘数字键 1-9,0 太远了) +set -g pane-base-index 1 # 面板编号也从 1 开始 +set -s escape-time 0 # 解决在 Emacs/Vim 中按 ESC 键有延迟的问题 +set -g history-limit 50000 # 增加滚动回溯行数(默认 2000 太短了) + +# --- 2. 快捷键重绑定 --- +# 将前缀键改为 Ctrl + a +unbind C-b +set -g prefix C-a +bind C-a send-prefix + +# 更直观的分屏快捷键 +bind v split-window -h -c "#{pane_current_path}" # v键垂直分屏 +bind h split-window -v -c "#{pane_current_path}" # h键水平分屏 + +# 使用 Alt + hjkl 切换面板(Vim 风格) +bind -n M-h select-pane -L +bind -n M-l select-pane -R +bind -n M-k select-pane -U +bind -n M-j select-pane -D + +# 使用 Alt + Shift + hjkl 调整面板大小 +bind -n M-H resize-pane -L 5 +bind -n M-L resize-pane -R 5 +bind -n M-K resize-pane -U 5 +bind -n M-J resize-pane -D 5 + +# 快速重载配置 (Prefix + r) +bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded!" + +# --- 3. 视觉与显示 --- +# 开启真彩色支持 +set -g default-terminal "screen-256color" +set-option -ga terminal-overrides ",xterm-256color:Tc" + +# 简单的状态栏美化 +set -g status-style "bg=#333333,fg=#5eacd3" +set -g status-left "#[fg=green][#S] " # 左侧显示会话名 +set -g status-right "%H:%M %Y-%m-%d" # 右侧显示时间