85 lines
2.8 KiB
Bash
85 lines
2.8 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 -ga terminal-overrides ",*256col*:Tc"
|
|
|
|
set-option -a terminal-features 'xterm-ghostty:RGB'
|
|
|
|
# 开启鼠标模式
|
|
set -g mouse on
|
|
|
|
# 绑定 `Ctrl-b m` 切换鼠标模式
|
|
bind m \
|
|
if-shell -F "#{mouse}" \
|
|
"set -g mouse off ; display 'Mouse: OFF'" \
|
|
"set -g mouse on ; display '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个单元格
|
|
|
|
bind -r j select-pane -t .+1 \; resize-pane -Z # prefix + j to switch pane in current window
|
|
|
|
# 设置tmux的延迟,文档说当有干扰的时候可以设置这个参数,比如影响vim编辑的时候
|
|
set -s escape-time 1
|
|
|
|
# 返回上一个窗口
|
|
bind L switch-client -l
|
|
|
|
# 移动当前窗口的位置
|
|
bind M command-prompt -p "移动窗口到位置:" "move-window -t '%%'" # 移动到指定索引
|
|
|
|
# 设置窗口名为当前目录名
|
|
set -g status-interval 10
|
|
set -g automatic-rename on
|
|
set -g automatic-rename-format '#{b:pane_current_path}'
|
|
|
|
set -g set-titles on
|
|
#set-option -g set-titles-string "#{session_name} - #{host}"
|
|
set -g set-titles-string "#{session_name}"
|
|
|
|
#允许终端程序通过转义序列设置通知
|
|
set -s set-clipboard on
|
|
set -g allow-passthrough on
|
|
|
|
# 1. 显式告诉 tmux 你的外壳终端支持 osc9 属性
|
|
set -as terminal-features ",*:osc9"
|
|
|
|
# 2. 强行把底层的 OSC 9 映射为直接穿透的转义包装
|
|
# \E]9;%p1%s\007 会被 tmux 自动包装成 \033Ptmux;\033]9;...\007\033\\ 发送出去
|
|
set -as terminal-overrides ",*:OSC 9=..."
|
|
#set -as terminal-overrides ",screen-256color:XT:OSC 9=\\E]9;%p1%s\\007"
|
|
set -as terminal-overrides ",screen*:OSC 9=..."
|
|
set -as terminal-overrides ",xterm*:OSC 9=..."
|
|
|
|
# List of plugins
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
set -g @plugin 'tmux-plugins/tmux-sensible'
|
|
set -g @plugin 'junegunn/fzf'
|
|
set -g @plugin 'tmux-plugins/tmux-fzf'
|
|
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
|
|
|
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
|
run '~/.tmux/plugins/tpm/tpm'
|