set -g prefix C-a unbind C-b bind C-a send-prefix # 启用鼠标支持 set -g mouse on # 终端颜色适配 set -g default-terminal "screen-256color" set -ga terminal-overrides ',xterm-256color:RGB' # 窗格/窗口索引从 1 开始 set -g base-index 1 set -g pane-base-index 1 # 关闭 tmux 时不自动终止会话 set -g detach-on-destroy off # 分屏快捷键 bind | split-window -h # 前缀键 + | :水平分屏(左右) bind - split-window -v # 前缀键 + - :垂直分屏(上下) # 窗格切换 bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R # 调整窗格大小 bind -r H resize-pane -L 5 bind -r J resize-pane -D 5 bind -r K resize-pane -U 5 bind -r L resize-pane -R 5 # 窗口操作快捷键 bind c new-window -n "new" bind x kill-pane bind & kill-window bind r source-file ~/.tmux.conf \; display-message "Tmux config reloaded!" # 会话操作 bind s choose-tree # 开启复制模式快捷键 bind -T copy-mode-vi v send-keys -X begin-selection bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel bind p paste-buffer set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-yank' set -g @plugin 'dracula/tmux' run '~/.tmux/plugins/tpm/tpm'