#bind new prefix 修改前缀按键(也就是命令快捷键) unbind-key C-b # 取消绑定 Ctrl + b set-option -g prefix C-f # 绑定 Ctrl + f bind-key C-f send-prefix
# using vi mode setw -g mode-keys vi # 使用 vi 模式 bind-key -T copy-mode-vi 'v' send -X begin-selection # vi 模式下的粘贴 bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle bind-key -T copy-mode-vi 'y' send -X copy-selection # vi 模式下的复制
# plugins # 一些插件,可以在 GitHub 上找到详细介绍 set -g @plugin 'tmux-plugins/tpm' # 插件管理器 set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @plugin 'tmux-plugins/tmux-yank'
# status bar # 截图下方右侧的状态栏 set -g status-style bg='black',fg='white' set -g status-interval 1 set -g status-left '#{?client_prefix,,}' set -g status-right '#[bg=default]#[fg=default]#(date "+%R ")#[bg=black]#[fg=brightgreen]#[bg=brightgreen]#[fg=black]Shawn#[bg=brightgreen]#[fg=black]' # 字体原因可能现实不全,但是可供参考
# window bar # 截图下方左侧的 window bar set -g window-status-current-format "#[bg=brightgreen]#[fg=black]#[bg=brightgreen]#[fg=black]#I:#W#[bg=black]#[fg=brightgreen]" # 同上字体原因 set -g window-status-format "#[bg=default]#[fg=default]#I:#W"
# pane border # pane 之间的分割线配置 set -g pane-border-style fg='gray' set -g pane-active-border-style fg='brightgreen'
# window and pane index # 违背祖宗之法的从 1 开始编号 set -g base-index 1 set -g pane-base-index 1
# hotkeys # 配置一些快捷键 bind h select-pane -L # 继承自 vim 的 h 为切换到左侧 pane bind j select-pane -D # 同上继承自 vim bind k select-pane -U # 同上继承自 vim bind l select-pane -R # 同上继承自 vim bind y resize-pane -L 5 # 选取 hjkl 上面四个按键,用于上下左右拉伸 pane bind u resize-pane -D 5 bind i resize-pane -U 5 bind o resize-pane -R 5 bind r source-file ~/.tmux.conf \; display-message "Config reloaded.." # 修改配置文件后方便重载配置
set -g display-panes-time 3000 set-option -g mouse on # 启用鼠标操控