-
Notifications
You must be signed in to change notification settings - Fork 2
/
.tmux.conf
222 lines (169 loc) · 7.35 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
#┃ ~/.tmux.conf
#┣━━━━━━━━━━━━━
#┃ mjturt
#----------------#
# Basic settings #
#----------------#
#set -g default-terminal "rxvt-unicode-256color"
set -g default-terminal "screen-256color"
set -q -g status-utf8 on
setw -q -g utf8 on
set -s focus-events on
set -g history-limit 30000
setw -g aggressive-resize on
set -s escape-time 0
set -sg repeat-time 600
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on
setw -g automatic-rename on
setw -g allow-rename off
set -g monitor-activity on
set -g visual-activity on
set -g set-titles on
set -g set-titles-string '#h #S ● #I #W'
set -g mouse on
set -g status-keys vi
set -g mode-keys vi
setw -g xterm-keys on
# set -g @copy_use_osc52_fallback on
#-------------#
# Keybindings #
#-------------#
unbind C-b
set -g prefix C-a
bind C-a send-prefix
bind e new-window -n '~/.tmux.conf - ' "sh -c 'nvim ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'"
bind C-r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
bind C-l send-keys C-l \; run 'sleep 0.1' \; clear-history
bind Z confirm-before -p "kill ALL unattached sessions? (y/n)" "run-shell 'tmux list-sessions | grep -v attached | cut -d: -f1 | xargs -t -n1 tmux kill-session -t && tmux display \"killed all unattached sessions\"'"
bind C-f command-prompt -p find-session 'switch-client -t %%'
bind R command-prompt -I "#{session_name}" "rename-session '%%'"
bind r command-prompt -I "#{window_name}" "rename-window '%%'"
bind C new-session
bind C-c new-window -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind > swap-pane -D
bind < swap-pane -U
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
bind + resize-pane -Z
unbind u
unbind i
bind -r u previous-window
bind -r i next-window
bind Tab last-window
bind X kill-window
bind Q confirm-before -p "kill-session #S? (y/n)" kill-session
bind C-s if -F '#{s/off//:status}' 'set status off' 'set status on'
bind b list-buffers
bind p paste-buffer
bind P choose-buffer
bind C-v copy-mode
bind -T root M-Up copy-mode
bind T clock-mode
# bind -T root F12 set prefix None \; set key-table off \; if -F '#{pane_in_mode}' 'send-keys -X cancel' \; refresh-client -S \;
# bind -T off F12 set -u prefix \; set -u key-table \; refresh-client -S
# bind -T off F1 run-shell "/home/mjt/.tmux/plugins/tmux-copycat/scripts/copycat_mode_start.sh '(https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&()*+-]*'"
# bind -T root F1 run-shell "/home/mjt/.tmux/plugins/tmux-copycat/scripts/copycat_mode_start.sh '(https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&()*+-]*'"
# Copy mode
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i -b"
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi Escape send-keys -X cancel
bind -T copy-mode-vi H send-keys -X start-of-line
bind -T copy-mode-vi J send-keys -X scroll-down
bind -T copy-mode-vi K send-keys -X scroll-up
bind -T copy-mode-vi L send-keys -X bottom-line
bind -T copy-mode-vi h send-keys -X cursor-left
bind -T copy-mode-vi j send-keys -X cursor-down
bind -T copy-mode-vi k send-keys -X cursor-up
bind -T copy-mode-vi l send-keys -X cursor-right
bind -T copy-mode-vi M-Up send-keys -X scroll-up
bind -T copy-mode-vi M-Down send-keys -X scroll-down
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xsel -i -b"
bind -T copy-mode-vi MouseUp3Pane send-keys -X cancel
# bind-key -T copy-mode-vi DoubleClick1Pane \
# select-pane \; \
# send-keys -X select-word \; \
# send-keys -X copy-pipe-and-cancel "xargs chromium"
# bind-key -n DoubleClick1Pane \
# select-pane \; \
# copy-mode -M \; \
# send-keys -X select-word \; \
# send-keys -X copy-pipe-and-cancel "xargs chromium"
# Choice mode
bind -T choice-mode-vi j send-keys -X down
bind -T choice-mode-vi k send-keys -X up
#---------------------#
# Colors / Appearance #
#---------------------#
set-option -g status-bg default
set-option -g status-fg colour127
set-option -g pane-border-style fg=colour059 # gray
set-option -g pane-active-border-style fg=colour4 # light blue
# set-option -g message-style fg=colour235 bg=colour127 # gray, gold
set-option -g display-panes-active-colour colour033 # light blue
set-option -g display-panes-colour colour166 # orange
set-window-option -g clock-mode-colour green
set-window-option -g mode-style "bg=green"
#------------#
# Statusline #
#------------#
set -g status-position bottom
set -g display-panes-time 800
set -g display-time 1500
set -g status-interval 5
set -g status-left-length 45
set -g status-right-length 150
set -g status off
# set -g status-left "#[bg=colour127] #(~/.statusscripts/tmux/distro-tmux.sh) \
# #[fg=colour254,bold,bg=colour242]#(~/.statusscripts/ssh.sh) \
# #[fg=colour052,bg=colour241]#(~/.statusscripts/tmux/off-tmux.sh) \
# #[fg=colour039,bg=colour240]#{?client_prefix,#[bold]#[nobold],} \
# #[fg=colour046,bg=colour239]#{?window_zoomed_flag,#[bold]#[nobold],} \
# #[fg=colour004,nobold,bg=colour237] #(whoami)#[fg=colour127,bold]@#[fg=colour004]#h \
# #[fg=colour002,nobold,bg=colour236] #S "
set -g status-left "#[bg=colour201] #(~/.statusscripts/tmux/distro-tmux.sh) #[fg=colour201,bg=colour165]\
#[fg=colour126,bold]#(~/.statusscripts/ssh.sh)#[fg=colour165,bg=colour129]\
#[fg=colour053]#(~/.statusscripts/tmux/off-tmux.sh)#[fg=colour129,bg=colour93]\
#[fg=colour039]#{?client_prefix,#[bold]#[nobold],}#{?window_zoomed_flag,#[fg=colour40] ,}#[fg=colour93,bg=colour56]\
#[fg=colour006,nobold] #(whoami)#[fg=colour201,bold]@#[fg=colour004]#h #[fg=colour56,bg=colour19,nobold]\
#[fg=colour002] #S #[fg=colour19,bg=default]"
# set -g status-right "#[bg=colour238,bold] #(~/.statusscripts/tmux/uptime.sh) \
# #[fg=colour255,bg=colour127] #[fg=colour232,nobold]%a %d #[bold]%H:%M "
set -g status-right "#[fg=colour57]#[bg=colour57,fg=colour4,bold] #[fg=colour16,nobold]#(~/.statusscripts/tmux/uptime.sh) \
#[fg=colour127,bg=colour57]#[fg=colour4,bold,bg=colour127] #[fg=colour232,nobold]%a %d #[bold]%H:%M "
set -g window-status-format " #I #W "
# set -g window-status-current-format "#[fg=colour16,bg=colour127,noreverse,bold] #I │ #W "
set -g window-status-current-format "#[fg=colour16,bg=colour127]#[fg=colour16,bg=colour127,noreverse,bold] #I #W #[fg=colour127,bg=default,nobold]"
set -g window-status-activity-style "fg=colour201,bold"
#----------------#
# Remote session #
#----------------#
if-shell 'test -n "$SSH_CLIENT"' 'set -g status-position top'
#--------------#
# Tmux plugins #
#--------------#
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin "arcticicestudio/nord-tmux"
# Plugin settings
set -g @emulate-scroll-for-no-mouse-alternate-buffer "on"
# Automatic tpm installation
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'