-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
291 lines (227 loc) · 8.45 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# QUICK TUTORIAL ON THESE MAPPINGS
#
# All commands begin with grave (i.e. the backtick `).
# All the mappings you will need:
#
# ` n New tab (called a "window" in tmux)
# ` d detach from the current session
# ` e Exit/close the current tab
# ` m Move the current tab
# ` t Move the current tab to the top
# ` r Rename the current tab
#
# ` v Vertical split
# ` | Vertical split
# ` s Horizontal split
# ` - Horizontal split
# ` b Break pane
# ` T Join the pane to window x
# ` F Join the pane from window x
#
# ` h Move left one split (called a "pane" in tmux)
# ` l Move right one split
# ` j Move up one split
# ` k Move down one split
# ` O Swap the panes vertically
# ` o Swap the panes Horizontally
#
# ` W Resize the current pane Up
# ` A Resize the current pane Left
# ` S Resize the current pane Down
# ` D Resize the current pane Right
# ` < Resize the panes evenly Vertically
# ` > Resize the panes evenly Horizontally
# ` V Synchronise panes
# ` z Maximuxe/restore pane to normal size (Default mapping)
#
# ` [ Move left one tab
# ` ] Move right one ta b
# ` ` Move to last tab
# ` g Reload this configuration file
# ` u Toggle read/write only mode
#
# ` i Toggle (start/stop) logging in the current pane
# ` I Save visible text (textual screenshot) (Alt-p)
# ` C-L Save complete history (Alt-P)
# ` C-c Clear logging history
#
#
# There are more mappings (read the rest of the file)
#
# Settings {{{
# default shell: bash
set -g default-command /bin/zsh
set -g default-shell /bin/zsh
# prevent fast scrolling from freezing tmux
# setw -g c0-change-interval 50 # (removed option)
# setw -g c0-change-trigger 80 # (removed option)
# basic settings
set-window-option -g xterm-keys on # for vim
set-window-option -g mode-keys vi # vi key
# 256 colors
set -g default-terminal "screen-256color"
# UTF8
# set-option -g status-utf8 on # (no longer necessary)
# Start numbering windows at 1
set -g base-index 1
# More history
set -g history-limit 100000
# This is necessary for vim to work properly
set-option -sg escape-time 0
# Rename windows
setw -g automatic-rename on
# Monitor activity, but without a big status message
setw -g monitor-activity on
set -g visual-activity off
# Better resizing
setw -g aggressive-resize on
# Show messages for slightly longer
set-option -g display-time 1000
# Sane scrolling
#set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# }}}
# Keybindings {{{
# Read-Only mode
bind u switch-client -r
# vim bindings
setw -g mode-keys vi
setw -g status-keys vi
# copy-mode
bind Escape copy-mode # Esc -- toggle copy-mode
# bind -t vi-copy Escape cancel
# bind -t vi-copy v begin-selection # v -- visual selection
# bind -t vi-copy y copy-selection # y -- yank to tmux clipboard
# bind -t vi-copy r rectangle-toggle # r -- toggle rectangular mode
bind p paste-buffer # paste from tmux clipboard
bind C-p paste-buffer
# tmux clipboard --> X windows
#bind y run "tmux show-buffer | xclip -i"
#bind C-y run "tmux show-buffer | xclip -i"
bind y run "tmux show-buffer | pbcopy"
bind C-y run "tmux show-buffer | pbcopy"
# X windows clipboard --> tmux
# Disabled since we can always use ctrl+shift+v on Ubuntu and cmd+v on Mac
# and it's too easy to clobber the tmux clipboard just after copy-mode
#bind C-p run "xclip -o | tmux load-buffer - ; tmux paste-buffer"
# Use ` instead of C-b
unbind `
unbind C-b
set -g prefix `
bind-key ` send-prefix # `` will send the prfix to a nested session
# Navigate panes with `-hjkl
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Navigate windows with `-[]
bind -r [ select-window -t :-
bind -r ] select-window -t :+
# Alias: also navigate panes with ctrl-jk (to match vim)
bind -r C-j select-pane -D
bind -r C-k select-pane -U
# Vim-style mappings -- n new, c close, v vert-split, s horiz-split, b break pane, T join-pane to, F join-pane from
# Also don't require that you let go of ctrl
bind e confirm-before "kill-pane"
bind C-e confirm-before "kill-pane"
bind n new-window -c "#{pane_current_path}"
bind C-n new-window -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
bind C-v split-window -h -c "#{pane_current_path}"
bind s split-window -c "#{pane_current_path}"
bind C-s split-window -c "#{pane_current_path}"
bind b break-pane
bind F command-prompt -p "join pane from:" "join-pane -s '%%'"
bind T command-prompt -p "send pane to:" "join-pane -t '%%'"
# Alias: Create Splits with | and -
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -c "#{pane_current_path}"
# Resize splits with `-WASD
bind -r W resize-pane -U 10
bind -r A resize-pane -L 10
bind -r S resize-pane -D 10
bind -r D resize-pane -R 10
# Rearrange splits with `-oO
bind -r O swap-pane -U
bind -r o swap-pane -D
# Even vertical split
bind < select-layout even-vertical
bind C-< select-layout even-vertical
# Even horizontal split
bind > select-layout even-horizontal
bind C-> select-layout even-horizontal
# Synchronize panes
bind V setw synchronize-panes
# Reload config file
bind g source-file ~/.tmux.conf\; display "reloaded ~/.tmux.conf"
# Rename current window -- note: doesn't work with automatic rename
bind r command-prompt -p "rename window to:" "rename-window '%%'"
bind C-r command-prompt -p "rename window to:" "rename-window '%%'"
# Switch to last active window
#bind ` last-window
# Move current window to Top position
bind t swap-window -t 1
bind C-t swap-window -t 1
# Move window to position
bind m command-prompt -p "move window to:" "swap-window -t '%%'"
bind C-m command-prompt -p "move window to:" "swap-window -t '%%'"
# Mouse interaction
set -g mouse on
# Confirm before detatch
bind d confirm-before "detach"
bind C-d confirm-before "detach"
## Toggle mouse on with ^a m
## NOTE: commented out since it conflicts with C-m for move
bind -Tcopy-mode MouseDragEnd1Pane send -X copy-selection
#bind m \
#set -g mode-mouse on \;\
#set -g mouse-resize-pane on \;\
#set -g mouse-select-pane on \;\
#set -g mouse-select-window on \;\
#display 'Mouse: ON'
## Toggle mouse off with ^a M
#bind M \
#set -g mode-mouse off \;\
#set -g mouse-resize-pane off \;\
#set -g mouse-select-pane off \;\
#set -g mouse-select-window off \;\
#display 'Mouse: OFF'
# }}}
# Copy over Environment variables
set-option -g update-environment "SSH_CLIENT"
# status bar {{{
set -g window-status-activity-style bold
set-window-option -g status-bg colour240
set-window-option -g window-status-style bg=colour240
set-window-option -g window-status-current-format '#[fg=yellow,bright][#I]#[fg=yellow,bright] #W'
set-window-option -g window-status-format '#[fg=green,bright][#I]#[fg=green,bright] #W'
set -g status-left-length 20
set -g status-right-length 100
set -g status-left "#[fg=red,bright] Session: #S "
set -g status-right " \
#[fg=colour201] #(if [[ -z $(tmux show-option -gqv @$(tmux display-message -p '#{session_name}_#{window_index}_#{pane_index}')) ]]; then echo 'not logging'; else echo \"$(tmux show-option -gqv @$(tmux display-message -p '#{session_name}_#{window_index}_#{pane_index}'))\"; fi)\
#[fg=yellow,bright] #(whoami)@#(hostname) #[fg=green,bright] %m-%d-%Y #[fg=green]%H:%M:%S %p #[default]#[fg=magenta,bright]#[default]"
# }}}
# Tmux Plugin Manager {{{
set -g @plugin 'tmux-plugins/tpm'
run -b '~/.tmux/plugins/tpm/tpm'
# }}}
# Tmux Logging {{{
# Install tmux-logging
set -g @plugin 'tmux-plugins/tmux-logging'
# Configure tmux-logging
set -g @logging_key "i"
set -g @screen-capture-key "I"
set -g @save-complete-history-key "C-L"
set -g @clear-history-key "C-c"
set -g @logging-path ".tmux/logs"
# set -g @logging-filename 'tmux-log_Session-${session_name}_Window-${window_index}_Pane-${pane_index}-%Y%m%dT%H%M%S.log'
set -g @screen-capture-path ".tmux/logs"
# set -g @screen-capture-filename 'tmux-screen-capture-_Session-${session_name}_Window-${window_index}_Pane-${pane_index}-%Y%m%dT%H%M%S.log'
set -g @save-complete-history-path ".tmux/logs"
# set -g @save-complete-history-filename 'tmux-complete-history_Session-${session_name}_Window-${window_index}_Pane-${pane_index}-%Y%m%dT%H%M%S.log'
# }}}
# Gitbar
source-file "$HOME/.tmux-gitbar/tmux-gitbar.tmux"
#set -g status-right '#(gitmux "#{pane_current_path}")'
#" THIS NEXT LINE MUST BE AT THE BOTTOM OF THE FILE, AND LEFT COMMENTED OUT!!!!!!!!!!!!
#" vim:foldmethod=marker:foldlevel=0