-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtmux.conf
100 lines (74 loc) · 4.07 KB
/
tmux.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Making tmux compatible with solarized/tokyonight colo schema
# 如果不设置这个数值, 那么颜色会看不清
set -g default-terminal "screen-256color"
# stop tmux rename window every time a cmd executed
set-option -g allow-rename off
set-option -g history-limit 10000
set-window-option -g mode-keys vi
bind -T prefix S set-window-option synchronize-panes
# 下面的几个涉及window选择的功能都要注意如下问题
# - If -s is omitted and a marked pane is present (see select-pane -m), the marked pane is used rather than the current pane.
bind -T prefix j join-pane -t ':!.' -s ':+0.'
# - 这个配合 prefix ! 拆散 pane一起用会比较好
# 还有的问题
# - 从一个多个 pane的window join 到另外一个单个pane的window, 这导致我必须先 ! 一下才能join
bind -T prefix W swap-pane -t ':!.' -s ':+0.'
# - 这个配合一个程序多个终端会比较好用
# 有时候跨session会出现换乱的情况,这时候到目标地址, 按 ^b ^f pane join 就可以准确地把他 merge回来
# 我想要的是 last window's last pane
# - 后面发现原来是需要用完整的格式
# BUG
# - 如果swap的时候不小心 按到了切换session的按键(比如 prefix w , prefix s), 那么有可能切换到last sesion
bind -T prefix K respawn-pane -k -c "#{pane_current_path}" # kill tmux-pane and respawn it
bind -T prefix C-d attach-session -d -t $WHOAMI
# https://unix.stackexchange.com/a/118381
# this will not work in low tmux version
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# for sainnhe/tmux-fzf
TMUX_FZF_LAUNCH_KEY="C-f"
TMUX_FZF_SESSION_FORMAT="#{session_windows} windows | #{pane_current_command}"
# https://github.com/sainnhe/tmux-fzf/blob/6e70fc5a75c1315cc8f33a6ca44c0f557f1d2de2/README.md
bind-key "C-p" run-shell -b "~/.tmux/plugins/tmux-fzf/scripts/session.sh attach"
# for neovim: 还不确定有什么用,从 install_neovim.sh 移动过来的
set-option -sg escape-time 10
set-option -sa terminal-overrides ',*-256color:RBG'
set-option -sa terminal-overrides ',*-256color:Tc'
# - 如果 terminal $TERM 能匹配上 '*-256color', 那么就设置 True Color (通过 tmux info) 能看得出来(这样才能正常在tmux 启动 True color, 否则tmux里面的配色就不对)
# - https://unix.stackexchange.com/a/568263
# - 这个不会在 default-terminal 后启动,所以不能假设直接就是 screen-256color, 很可能是原有的 xterm-256color
set -g mouse on
# name a pane
# https://stackoverflow.com/a/49433342
# set pane-border-status top
# printf '\033]2;%s\033\\' 'title goes here'
# tmux-pet
set -g @pet-new-pane-key 'e' # p(e)t
# TPM -------------------------------------
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @plugin 'egel/tmux-gruvbox'
set -g @plugin 'thewtex/tmux-mem-cpu-load'
set -g @plugin 'you-n-g/tmux-gruvbox' # Modified Version
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'haru-ake/tmux-pet'
# The config below seems not working
# # Undercurl
# set -g default-terminal "${TERM}"
# set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
# set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
# NOTE:
# - tmux 如果安装的是系统版本, 上述plugin(tmux-pet, tmux-fzf)可能会不work (后来换成conda 最新版本就没问题了);
# FAQ ------------------------
# chsh 有时候不work,有了这一行后, `<C-b>: source-file ~/.tmux.conf` 就能更快切换tmux了
# - https://superuser.com/questions/253786/how-can-i-make-tmux-use-my-default-shell
# - 最后似乎还是不work
# set-option -g default-shell $SHELL
# 最后能work的是: 上面那句话指向绝对的shell path 加 tmux source, 并且重启pane ( <leader> + K 没有用 )