Last active
April 23, 2023 18:54
-
-
Save pengshp/571c28cac6f41fe7d532823c41a6f5d6 to your computer and use it in GitHub Desktop.
~/.config/tmux/tmux.conf tmux3.3a+ config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _ __ | |
# | |_ _ __ ___ _ ___ __ ___ ___ _ __ / _| | |
# | __| '_ ` _ \| | | \ \/ / / __/ _ \| '_ \| |_ | |
# | |_| | | | | | |_| |> < | (_| (_) | | | | _| | |
#(_)__|_| |_| |_|\__,_/_/\_(_)___\___/|_| |_|_| | |
# tmux version tmux 3.3a | |
# https://github.com/tmux/tmux | |
## 配置参考:http://louiszhai.github.io/2017/09/30/tmux/ | |
# 从tmux v1.6版起,支持设置第二个指令前缀 | |
# 设置一个不常用的键Ctrl+a作为指令前缀,按键更快些 | |
set-option -g prefix2 C-a | |
set -g history-limit 10000 | |
## 面板管理 | |
unbind '"' | |
bind - splitw -v -c '#{pane_current_path}' | |
# 垂直方向新增面板,默认进入当前目录 | |
unbind % | |
bind | splitw -h -c '#{pane_current_path}' | |
# 水平方向新增面板,默认进入当前目录 | |
# Set easier window split keys | |
bind-key v split-window -h | |
bind-key h split-window -v | |
# Use <Alt-arrow> keys to switch panes | |
bind -n M-Left select-pane -L | |
bind -n M-Right select-pane -R | |
bind -n M-Up select-pane -U | |
bind -n M-Down select-pane -D | |
# <Shift arrow> to switch windows | |
bind -n S-Left previous-window | |
bind -n S-Right next-window | |
# Easy config reload | |
bind-key r source-file ~/.config/tmux/tmux.conf | |
bind-key x kill-pane # skip "kill-pane 1? (y/n)" prompt | |
# A Nice Purple For the Active Panel | |
set-option -g pane-border-style fg="#bd93f9" | |
# 开启鼠标的支持 | |
set-option -g mouse on | |
set -g set-clipboard on # use system clipboard | |
# popup | |
# bind T display-popup -E "~/.local/bin/tt" | |
set-option -g detach-on-destroy off | |
## 面板大小调整 | |
# 绑定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 m command-prompt "splitw -h 'exec man %%'" | |
# 绑定m键为在新的panel打开man | |
# 绑定P键为开启日志功能,如下,面板的输出日志将存储到/tmp | |
bind P pipe-pane -o "cat >>/tmp/#W.log" \; display "Toggled logging to /tmp/#W.log" | |
# Toggle popup window with Alt-e | |
bind-key -n -N 'Toggle popup window' M-e if-shell -F '#{==:#{session_name},popup}' { | |
detach-client | |
} { | |
display-popup -d "#{pane_current_path}" -xC -yC -w 80% -h 75% -E 'tmux attach-session -t popup || tmux new-session -s popup' | |
} | |
## 复制操作 | |
# 开启vi风格后,支持vi的C-d、C-u、hjkl等快捷键 | |
setw -g mode-keys vi | |
# tmux v2.4+ v 选择 y 复制 | |
bind -T copy-mode-vi v send-keys -X begin-selection | |
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel | |
set -g base-index 1 # 设置窗口的起始下标为1 | |
set -g pane-base-index 1 # 设置面板的起始下标为1 | |
## 自定义状态栏 | |
set -g status-justify left # 状态栏列表左对齐 | |
#set -g status-right '#{prefix_highlight} | %a %H:%M' | |
setw -g monitor-activity on # 非当前窗口有内容更新时在状态栏通知 | |
set -g visual-activity on | |
set -wg window-status-format " #I #W " # 状态栏窗口名称格式 | |
set -wg window-status-current-format " #I:#W#F " | |
# 状态栏当前窗口名称格式(#I:序号,#w:窗口名称,#F:间隔符) | |
set -wg window-status-separator " | " # 状态栏窗口名称之间的间隔 | |
## 开启256 colors支持 | |
#set -g default-terminal "xterm-256color" | |
set -g default-terminal "tmux-256color" | |
set -ga terminal-overrides ",*256col*:Tc" | |
set-option -g focus-events on | |
# Escape time (to fix neovim issues) | |
set -sg escape-time 0 | |
set -g @prefix_highlight_show_copy_mode 'on' | |
set -g @prefix_highlight_show_sync_mode 'on' | |
set -g @prefix_highlight_prefix_prompt 'Wait' | |
set -g @prefix_highlight_copy_prompt 'Copy' | |
set -g @prefix_highlight_sync_prompt 'Sync' | |
set -g @resurrect-capture-pane-contents 'on' | |
set -g @continuum-restore 'on' | |
# catppuccin theme: latte,frappe,macchiato,mocha | |
set -g @catppuccin_flavour 'mocha' | |
# set -g @catppuccin_user "on" | |
# set -g @catppuccin_host "on" | |
set -g @t-fzf-prompt ' ' | |
# tmux-fzf | |
# prefix + F | |
TMUX_FZF_MENU=\ | |
"bottom\nbtm\n"\ | |
"gitui\ngitui\n"\ | |
"htop\nhtop\n" | |
##--------- tpm ----------------------------------- | |
# List of plugins | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
set -g @plugin 'catppuccin/tmux' | |
set -g @plugin 'tmux-plugins/tmux-prefix-highlight' | |
# persist tmux sessions after computer restart | |
set -g @plugin 'tmux-plugins/tmux-resurrect' | |
# automatically saves sessions for you every 15 minutes | |
set -g @plugin 'tmux-plugins/tmux-continuum' | |
set -g @plugin 'sainnhe/tmux-fzf' | |
set -g @plugin 'joshmedeski/t-smart-tmux-session-manager' | |
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
run '~/.config/tmux/plugins/tpm/tpm' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment