Files
.dotfile/.tmux.conf
2023-07-31 19:50:17 +08:00

49 lines
1.6 KiB
Bash

setw -g mode-keys vi
#unbind ^b
#set -g prefix 'C-a'
#set -g prefix `
#bind-key ` send-prefix
bind r source-file ~/.tmux.conf \; display-message "Config reloaded"
# 切分面板
# unbind '"'
bind - splitw -v -c '#{pane_current_path}'
# unbind %
bind | splitw -h -c '#{pane_current_path}'
# 开启 24bit 真彩色,tmux > 2.2 开始支持
set -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",*256col*:Tc"
set-option -g mouse on
# 绑定hjkl键为面板切换的上下左右键
bind k select-pane -U # 绑定k为↑
bind j select-pane -D # 绑定j为↓
bind h select-pane -L # 绑定h为←
bind l select-pane -R # 绑定l为→
# 绑定Ctrl+hjkl键为面板上下左右调整边缘的快捷指令
bind -r K resizep -U 10 # 绑定Ctrl+k为往↑调整面板边缘10个单元格
bind -r J resizep -D 10 # 绑定Ctrl+j为往↓调整面板边缘10个单元格
bind -r H resizep -L 10 # 绑定Ctrl+h为往←调整面板边缘10个单元格
bind -r L resizep -R 10 # 绑定Ctrl+l为往→调整面板边缘10个单元格
# 设置tmux的延迟,文档说当有干扰的时候可以设置这个参数,比如影响vim编辑的时候
set -s escape-time 1
# 返回上一个窗口
bind g last-window
# 设置窗口名为当前目录名
set-option -g status-interval 10
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'
set-option -g set-titles on
#set-option -g set-titles-string "#{session_name} - #{host}"
set-option -g set-titles-string "#{session_name}"
# tmux resurrect
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux