-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.tmux.conf
More file actions
204 lines (149 loc) · 5.85 KB
/
Copy path.tmux.conf
File metadata and controls
204 lines (149 loc) · 5.85 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
############################
##### GENERAL SETTINGS #####
############################
# set terminal type
set -g default-terminal "screen-256color"
# long scrollback buffer
set -g history-limit 100000
# listen for activity on all windows
set -g bell-action any
# xterm-style function key sequences
setw -g xterm-keys on
# control automatic window renaming
setw -g automatic-rename on
# pane indexes start from 1, not 0
set -g base-index 1
# auto renumber window on close
setw -g renumber-windows on
setw -g aggressive-resize on
# focus events enabled for terminals that support them
set -g focus-events on
# workaround for DBUS notification not showing
set -g update-environment "DBUS_SESSION_BUS_ADDRESS DISPLAY SSH_AUTH_SOCK XAUTHORITY"
###########################
##### KEYBOARD CONFIG #####
###########################
# C-a instead of C-b
unbind-key C-b
set -g prefix C-a
# press ; to issue command
bind-key \; command-prompt
# fast Esc
set -s escape-time 10
# send the prefix to client inside window
bind-key C-a send-prefix
# disable repeat time
set -g repeat-time 0
# use vi keys in copy-mode
set -g mode-keys vi
# new pane/window with current directory
bind-key c new-window -c '#{pane_current_path}'
bind-key C new-window -a -c '#{pane_current_path}'
bind-key r rotate-window
# switch panes with alt + arrows
bind-key -n M-Up if-shell -F "#{?window_zoomed_flag,0,#{s/1/0/:window_panes}}" "select-pane -U" "send-keys 'M-Up'"
bind-key -n M-Down if-shell -F "#{?window_zoomed_flag,0,#{s/1/0/:window_panes}}" "select-pane -D" "send-keys 'M-Down'"
bind-key -n M-Left if-shell -F "#{?window_zoomed_flag,0,#{s/1/0/:window_panes}}" "select-pane -L" "send-keys 'M-Left'"
bind-key -n M-Right if-shell -F "#{?window_zoomed_flag,0,#{s/1/0/:window_panes}}" "select-pane -R" "send-keys 'M-Right'"
# select last pane with alt + f
bind-key -n M-f last-pane
# split window with alt + shift + arrows
bind-key -n M-S-Up split-window -vb -c '#{pane_current_path}'
bind-key -n M-S-Down split-window -v -c '#{pane_current_path}'
bind-key -n M-S-Left split-window -hb -c '#{pane_current_path}'
bind-key -n M-S-Right split-window -h -c '#{pane_current_path}'
# switch windows with alt + j/k or q/w
bind-key -n M-q previous-window
bind-key -n M-w next-window
# mark pane with alt + m
bind-key -n M-m select-pane -m
# move marked pane to current window with alt + p/P
bind-key -n M-p join-pane -h
bind-key -n M-P join-pane -v
# select window with alt + number
bind-key -n M-1 select-window -t :=1
bind-key -n M-2 select-window -t :=2
bind-key -n M-3 select-window -t :=3
bind-key -n M-4 select-window -t :=4
bind-key -n M-5 select-window -t :=5
bind-key -n M-6 select-window -t :=6
bind-key -n M-7 select-window -t :=7
bind-key -n M-8 select-window -t :=8
bind-key -n M-9 select-window -t :=9
# zoom pane with alt + 0
bind-key -n M-0 resize-pane -Z
# switch pane border status with prefix + t/T
bind-key t set pane-border-status off
bind-key T set pane-border-status top
bind-key p run-shell "pstree -alU #{pane_pid}"
bind-key P run-shell "pstree -alpU #{pane_pid}"
# integrate with system clipboard
bind-key -t vi-copy y copy-pipe "xsel -ipb"
bind-key -n C-v run "xsel -bo | tmux load-buffer - ; tmux paste-buffer"
bind-key C-v send C-v
########################
##### MOUSE CONFIG #####
########################
set -gq mouse on
bind-key -n WheelUpPane \
if-shell -Ft= "#{?pane_active,0,1}" "select-pane -t=" \; \
if-shell -Ft= "#{pane_in_mode}" \
"send-keys -M ; send-keys -M ; send-keys -M" \
"if-shell -Ft= \"#{mouse_any_flag}\" \
\"send-keys -M\" \
\"if-shell -Ft= '#{alternate_on}' \
'send-keys Up Up Up' \
'copy-mode -e'\""
bind-key -n WheelDownPane \
if-shell -Ft= "#{?pane_active,0,1}" "select-pane -t=" \; \
if-shell -Ft= "#{pane_in_mode}" \
"send-keys -M ; send-keys -M ; send-keys -M" \
"if-shell -Ft= \"#{mouse_any_flag}\" \
\"send-keys -M\" \
\"if-shell -Ft= '#{alternate_on}' \
'send-keys Down Down Down'\""
# paste with middle click
bind-key -n MouseDown2Pane run "xsel -o | tmux load-buffer - ; tmux paste-buffer"
# drag & drop windows on status line by mouse
bind-key -n MouseDrag1Status swap-window -t=
# new window by right click on status line
bind-key -n MouseDown3Status new-window -a -t= -c '#{pane_current_path}'
# new window in background by middle click on status line
bind-key -n MouseDown2Status new-window -ad -t= -c '#{pane_current_path}'
# don't scroll to bottom after mouse select
bind-key -t vi-copy MouseDragEnd1Pane copy-selection -x
# exit from copy-mode with right-click
unbind-key -n MouseDown3Pane
bind-key -t vi-copy MouseDown3Pane cancel
# old mouse handling (tmux 2.0 and before)
set -gq mode-mouse on
set -gq mouse-resize-pane on
set -gq mouse-select-pane on
set -gq mouse-select-window on
###############################
##### STATUS LINE OPTIONS #####
###############################
set -g set-titles on
set -g set-titles-string "[tmux] #T"
setw -g window-status-format '#F#I:#{=24:window_name}'
setw -g window-status-current-format '#{?client_prefix,#[bg=red],#{?pane_in_mode,#[bg=yellow]#[fg=black],#[bg=blue]}} #F#I:#{=24:window_name} '
set -g window-status-separator ' '
set -g status-left '[#S] '
set -g status-left-length 20
set -g status-right ' #{pane_pid}: #T '
set -g pane-border-status top
set -g pane-border-format '#[fg=black]#{?pane_in_mode,#[bg=yellow],#[bg=white]#[bold]} #T '
# status bar messages display time
set -g display-time 3000
# refresh status line frequency (in sec)
set -g status-interval 2
##################
##### STYLES #####
##################
set -g pane-border-style fg=blue,bg=white
set -g pane-active-border-style fg=white,bg=blue
set -g status-style fg=black,bg=white
set -g status-right-style fg=white,bg=blue,bold
setw -g window-status-style default,bold
setw -g window-status-current-style fg=white,bg=blue,bold
set -g message-style fg=white,bg=blue,bright