-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtmux.conf
More file actions
180 lines (139 loc) · 5.38 KB
/
tmux.conf
File metadata and controls
180 lines (139 loc) · 5.38 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
set-option -g status-position top
# recognise extended keys
set -s extended-keys on
set -as terminal-features 'xterm-kitty*:extkeys'
bind-key -T root M-s send-keys Escape "[115;9u"
bind-key -T root M-/ send-keys Escape "[47;9u"
bind-key -T root M-a send-keys Escape "[97;9u"
# action key
unbind C-b
set -g prefix C-t
set -g xterm-keys on
set -s escape-time 0
set -sg repeat-time 300
set -s focus-events on
set -g mouse on
set -sg exit-empty on
set -q -g status-utf8 on
setw -q -g utf8 on
set -g visual-activity off
setw -g monitor-activity off
setw -g monitor-bell off
set -g history-limit 10000
# bind t send-key C-t
# Reload settings
bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded!"
# display
set -g base-index 1
setw -g pane-base-index 1
setw -g automatic-rename on
set -g renumber-windows on
# allow the title bar to adapt to whatever host you connect to
set -g set-titles on
set -g set-titles-string "#T"
set -g display-panes-time 2000
set -g display-time 2000
set -g status-interval 1
# window management
bind -n M-c new-window -c "#{pane_current_path}"
# break pane to window
bind -n M-b break-pane
# close self pane
# bind -n M-c kill-pane
# close other pane
bind -n M-o kill-pane -a
# close window
bind -n M-q kill-window
# close other window
bind -n M-e kill-window -a
bind -n C-M-h previous-window
bind -n C-M-l next-window
# rebind split window
unbind %
bind | split-window -h
unbind '"'
bind - split-window -v
bind > swap-pane -D
bind < swap-pane -U
bind -n M-Space next-layout
bind W choose-tree -Z
bind H choose-tree 'move-pane -v -s "%%"'
bind V choose-tree 'move-pane -h -s "%%"'
# set -g status-keys emacs
set -g mode-keys vi
bind -n M-v copy-mode
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind -T copy-mode-vi h send-keys -X cursor-left
bind -T copy-mode-vi l send-keys -X cursor-right
bind -T copy-mode-vi k send-keys -X cursor-up
bind -T copy-mode-vi j send-keys -X cursor-down
bind -T copy-mode-vi e send-keys -X next-word-end
bind -T copy-mode-vi K send-keys -N 5 -X cursor-up
bind -T copy-mode-vi J send-keys -N 5 -X cursor-down
bind -T copy-mode-vi H send-keys -X start-of-line
bind -T copy-mode-vi L send-keys -X end-of-line
# 缺少依赖 需要安装依赖xclip
bind -T copy-mode-vi Y send-keys -X copy-end-of-line
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# 下面两个没有效果
bind -T copy-mode-vi = send-keys -X search-again
bind -T copy-mode-vi = send-keys -X search-reverse
set -g set-clipboard on
# Moving window
bind-key \{ swap-window -t -1 \; previous-window
bind-key \} swap-window -t +1 \; next-window
# NOTE: git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# NOTE:安装插件 <C-t> + I
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
# termux上不需要它,其他不清楚
# set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# <C-t> + F
set -g @plugin 'sainnhe/tmux-fzf'
TMUX_FZF_LAUNCH_KEY="o"
# Default value in tmux >= 3.2
TMUX_FZF_OPTIONS="-p -w 60% -h 40% -m"
# <C-t> + u
set -g @plugin 'wfxr/tmux-fzf-url'
set -g @fzf-url-fzf-options '-p 60%,30% --prompt=" " --border-label=" Open URL "'
set -g @fzf-url-history-limit '2000'
# gruvbox
# set -g @plugin 'egel/tmux-gruvbox'
# set -g @tmux-gruvbox 'dark'
source-file ~/.config/tmux/gruvbox/gruvbox_dark.tmux
# 保存session
set -g @plugin 'tmux-plugins/tmux-resurrect'
# 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
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?(g?\.?(view|n?vim?x?)(-wrapped)?(diff)?|fzf)'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' }
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' }
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' { if -F '#{pane_at_top}' '' 'select-pane -U' }
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' { if -F '#{pane_at_right}' '' 'select-pane -R' }
bind-key -T copy-mode-vi 'C-h' if -F '#{pane_at_left}' '' 'select-pane -L'
bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' '' 'select-pane -D'
bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' '' 'select-pane -U'
bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' '' 'select-pane -R'
bind -n 'C-Left' if-shell "$is_vim" 'send-keys C-Left' 'resize-pane -L 1'
bind -n 'C-Down' if-shell "$is_vim" 'send-keys C-Down' 'resize-pane -D 1'
bind -n 'C-Up' if-shell "$is_vim" 'send-keys C-Up' 'resize-pane -U 1'
bind -n 'C-Right' if-shell "$is_vim" 'send-keys C-Right' 'resize-pane -R 1'
# 清除终端
bind -n C-M-n send-keys C-l \;
bind-key -T copy-mode-vi C-Left resize-pane -L 1
bind-key -T copy-mode-vi C-Down resize-pane -D 1
bind-key -T copy-mode-vi C-Up resize-pane -U 1
bind-key -T copy-mode-vi C-Right resize-pane -R 1
# set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
# bootstrap tpm
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
run '~/.tmux/plugins/tpm/tpm'