-
Notifications
You must be signed in to change notification settings - Fork 19
/
.tmux.conf
207 lines (170 loc) · 5.39 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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# tmux 3.2a+
# Key Binding --------------------{{{
# 前缀
unbind C-b
set -g prefix C-a
bind C-a send-prefix
bind r source-file ~/.tmux.conf \; display-message "Config Reloaded!"
unbind %
bind | split-window -h -c "#{pane_current_path}" # 使用|竖屏,方便分屏 使用当前路径
unbind '"'
bind - split-window -v -c "#{pane_current_path}" # 使用-横屏,方便分屏
# use vim mode to move panel
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind K clear-history
bind l select-pane -R
bind v swap-pane
bind-key * list-clients
## Join windows: <prefix> s, <prefix> j
bind-key g command-prompt -p "send pane to:" "join-pane -t '%%'"
# move this pane to a new widnow 独占当前 widnow
bind-key G break-pane -b
# Move window to left
bind \{ swap-window -t -1\; select-window -t -1
bind \} swap-window -t +1\; select-window -t +1
# Killer
bind x kill-pane
bind X kill-window
# open customeize mode
bind -N 'Customize options' U customize-mode -Z
# working directory
# set default directory for new windows in this session to current directory:
bind b attach-session -c "#{pane_current_path}"
# open a new window in the current directory
bind C new-window -c "#{pane_current_path}"
set -g set-titles on
set -g set-titles-string "[#S] #I:#W"
# }}}
# General settings --------------------{{{
setw -g mode-keys vi
set -g default-terminal "screen-256color" # use 256 colors
set -g display-time 4001 # status line messages display
set -g history-limit 100000 # scrollback buffer n lines
set -g base-index 1
setw -g pane-base-index 1
# focus events enabled for terminals that support them
set -g focus-events on
# super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# for vim's delaying escape:
# https://github.com/neovim/neovim/wiki/FAQ#esc-in-tmux-or-gnu-screen-is-delayed
set -sg escape-time 10
set -g mouse on
# }}}
# Status bar --------------------{{{
set -g status-bg black
set -g status-fg white
set-option -g status-justify left
set-option -g status-left '#[fg=cyan][#{session_name}]'
set-option -g status-right '#[fg=#9e5d3c]#(tmux-status-right.sh)'
# window
setw -g automatic-rename off
set-option -g allow-rename off
set-window-option -g window-style default
set-window-option -g clock-mode-colour black
set-window-option -g clock-mode-style 24
set-window-option -g monitor-activity on
# disable sound bell
set -g bell-action none
set -g visual-bell on
bind-key c new-window -n 'shell'
# }}}
# panel --------------------{{{
set-option -g display-panes-active-colour blue
set-option -g display-panes-colour brightred
# }}}
set-window-option -g window-status-current-style fg='#333333',bg="#ff9966"
# message style
set-option -g message-style bg=colour232
set-option -g message-style fg=colour5
# to support underline in kitty
# https://evantravers.com/articles/2021/02/05/curly-underlines-in-kitty-tmux-neovim/
# undercurl support
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
# underscore colors - needs tmux-3.0
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
# copy last command output
bind -n S-Left {
copy-mode
send -X clear-selection
send -X start-of-line
send -X start-of-line
send -X cursor-up
send -X start-of-line
send -X start-of-line
if -F "#{m:*➜ *,#{copy_cursor_line}}" {
send -X search-forward-text "➜ "
send -X stop-selection
send -X -N 2 cursor-right
send -X begin-selection
send -X end-of-line
send -X end-of-line
if "#{m:*➜ ?*,#{copy_cursor_line}}" {
send -X cursor-left
}
} {
send -X end-of-line
send -X end-of-line
send -X begin-selection
send -X search-backward-text "➜ "
send -X end-of-line
send -X end-of-line
send -X cursor-right
send -X stop-selection
}
}
bind -n S-Up {
copy-mode
send -X clear-selection
send -X start-of-line
send -X start-of-line
send -X cursor-left
send -X begin-selection
send -X search-backward "(\\$ )|(# )"
send -X start-of-line
send -X start-of-line
send -X stop-selection
}
bind -n S-Down {
copy-mode
send -X clear-selection
send -X end-of-line
send -X end-of-line
send -X search-forward "(\\$ )|(# )"
send -X start-of-line
send -X start-of-line
send -X begin-selection
send -X search-forward "(\\$ )|(# )"
send -X search-forward "(\\$ )|(# )"
send -X start-of-line
send -X start-of-line
send -X cursor-left
send -X stop-selection
}
set -s copy-command 'pbcopy'
bind u 'display-message "close window to right!"; run-shell "tkw_tmux-kill-window-to-right.sh"'
unbind H
unbind J
unbind K
unbind L
bind H move-pane -t '.{left-of}'
bind L move-pane -t '.{right-of}'
bind J move-pane -h -t '.{down-of}'
bind K move-pane -h -t '.{up-of}'
# Quick select windows
# https://superuser.com/questions/755634/how-to-quickly-switch-to-n-10-windows-in-tmux
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Send the same command to all panes/windows in current session
unbind E
bind E command-prompt -p "Command(all panes in session):" \
"run \"tmux list-panes -s -F '##{session_name}:##{window_index}.##{pane_index}' \
| xargs -I PANE tmux send-keys -t PANE '%1' Enter\""
bind -r \\ select-window -l
# Copy selected text without exiting copy-mode
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection
# prefix o is cover
unbind o
bind o switch-client -t spex