-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
249 lines (193 loc) · 8.4 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
# -----------------------------------------------------------------------------
# This config is targeted for tmux 2.1+ and should be placed in $HOME.
#
# Created from several notes on the web. Thanks to everyone for sharing
# It's a work in progress
# -----------------------------------------------------------------------------
# Version 1.0.9
# -----------------------------------------------------------------------------
# Global options
# -----------------------------------------------------------------------------
# Version settings based on info from [Stack Overflow](https://stackoverflow.com/a/40902312)
run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | \
sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.1" | bc)" = 1 ]' " \
set -g mouse-select-pane on; set -g mode-mouse on; \
set -g mouse-resize-pane on; set -g mouse-select-window on; \
set -g message-fg red; \
set -g message-bg black; \
set -g message-attr bright; \
set -g window-status-bg default; \
set -g window-status-fg default; \
set -g window-status-current-attr bold; \
set -g window-status-current-bg cyan; \
set -g window-status-current-fg default; \
set -g window-status-bell-fg red; \
set -g window-status-bell-bg black; \
set -g window-status-activity-fg white; \
set -g window-status-activity-bg black"
# In version 2.1 "mouse" replaced the previous 4 mouse options
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.1" | bc)" = 1 ]' \
"set -g mouse on"
# UTF8 is autodetected in 2.2 onwards, but errors if explicitly set
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.2" | bc)" = 1 ]' \
"set -g utf8 on; set -g status-utf8 on; set -g mouse-utf8 on"
# bind-key syntax changed in 2.4 -- selection / copy / paste
# if-shell -b '[ "$(echo "$TMUX_VERSION < 2.4" | bc)" = 1 ]' " \
# bind-key -t vi-copy v begin-selection; \
# bind-key -t vi-copy V send -X select-line; \
# bind-key -t vi-copy C-v rectangle-toggle; \
# bind-key -t vi-copy y copy-pipe 'xclip -selection clipboard -in'"
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.6" | bc)" = 1 ]' \
"set -s set-clipboard on"
# Newer versions
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.9" | bc)" = 1 ]' " \
bind-key h split-window -v; \
bind-key '\\' split-window -h; \
unbind 'W'; \
bind-key 'W' choose-tree -w; \
set-window-option -g window-status-current-attr bold; \
set-window-option -g window-status-current-fg colour223; \
set -as terminal-overrides ',screen-256color:Ms=\E]52;%p1%s;%p2%s\007'"
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.9" | bc)" = 1 ]' \
"set -g message-style fg=red,bg=black; \
set -g message-style bright; \
bind-key h split-window -v; \
bind-key '\\' split-window -h; \
unbind 'W'; \
bind-key 'W' choose-tree -Zw; \
set -g window-status-style fg=default,bg=default; \
set -g window-status-bell-style fg=red,bg=black; \
set -g window-status-activity-style fg=white,bg=black; \
set -s set-clipboard on; \
set -as terminal-overrides ',screen-256color:Ms=\E]52;%p1%s;%p2%s\007'"
if-shell -b '[ "$(echo "$TMUX_VERSION >= 3.2" | bc)" = 1 ]' \
"set -as terminal-features ',screen-256color:clipboard'"
# Set a new prefix / leader key.
set -g prefix `
bind ` send-prefix
# Allow opening multiple terminals to view the same session at different sizes.
setw -g aggressive-resize on
# Remove delay when switching between Vim modes.
set -s escape-time 0
# Allow Vim's FocusGained to work when your terminal gains focus.
# Requires Vim plugin: https://github.com/tmux-plugins/vim-tmux-focus-events
set -g focus-events on
# Add a bit more scroll history in the buffer.
set -g history-limit 50000
# Enable color support inside of tmux.
set -g default-terminal "screen-256color"
# Ensure window titles get renamed automatically.
set-window-option -g automatic-rename on
set-option -g set-titles on
# Start windows and panes index at 1, not 0.
set -g base-index 1
setw -g pane-base-index 1
# Enable full mouse support.
# set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set -g mouse on
# Status bar optimized for Gruvbox.
set -g status-fg default
set -g status-bg default
# -----------------------------------------------------------------------------
# Key bindings
# -----------------------------------------------------------------------------
# Unbind default keys
unbind C-b
unbind '"'
unbind %
# Reload the tmux config.
bind-key r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# Open ~/.tmux.conf in nano and reload settings on quit
unbind e
bind e new-window -n '~/.tmux.conf' "sh -c 'nano ~/.tmux.conf && tmux source ~/.tmux.conf'"
# Kill the session
bind-key k kill-session
# Configure copying
# use emacs mode
setw -g mode-keys emacs
set -g status-keys emacs
# Enter copy mode
bind-key 'c' copy-mode
bind-key -Tcopy-mode 'C' send-keys -X rectangle-toggle
bind-key -Tcopy-mode 'c' send -X begin-selection
bind-key -Tcopy-mode ENTER send-keys -X copy-selection-and-cancel
bind-key -Tcopy-mode C-Left send-keys -X previous-word
bind-key -Tcopy-mode C-Right send-keys -X next-word-end
# Enable copy on select. Requires xsel on the server, X11 forwarding on the terminal
# and VcXsrv installed on the workstation with clipboard enabled
# unbind -n -Tcopy-mode MouseDragEnd1Pane
# bind -Tcopy-mode MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | xsel -ib"
unbind -n MouseDown3Pane
bind -n MouseDown3Pane run "tmux set-buffer \"$(xsel -o)\" ;tmux paste-buffer"
unbind 'w'
bind-key 'w' new-window
# Move around panes with ALT + arrow keys.
bind-key -n M-Up select-pane -U
bind-key -n M-Left select-pane -L
bind-key -n M-Down select-pane -D
bind-key -n M-Right select-pane -R
# window navigation
bind-key -n C-n new-window
unbind n
unbind p
bind-key -n M-S-Left previous-window # select previous window
bind-key -n M-S-Right next-window # select next window
bind Tab last-window # move to last active window
# =====================================
# === Theme ===
# =====================================
# Feel free to NOT use this variables at all (remove, rename)
# this are named colors, just for convenience
color_orange="colour166" # 208, 166
color_purple="colour134" # 135, 134
color_green="colour076" # 070
color_blue="colour39"
color_yellow="colour220"
color_red="colour160"
color_black="colour232"
color_white="colour7" # 015
# This is a theme CONTRACT, you are required to define variables below
# Change values, but not remove/rename variables itself
color_dark="$color_black"
color_light="$color_white"
color_session_text="$color_blue"
color_status_text="$color_white"
color_main="$color_orange"
color_secondary="$color_purple"
color_level_ok="$color_green"
color_level_warn="$color_yellow"
color_level_stress="$color_red"
color_window_off_indicator="colour088"
color_window_off_status_bg="colour238"
color_window_off_status_current_bg="colour254"
# =====================================
# === Appearence and status bar ===
# ======================================
set -g mode-style "fg=default,bg=$color_main"
# command line style
set -g message-style "fg=$color_main,bg=$color_dark"
# status line style
set -g status-style "fg=$color_status_text,bg=$color_dark"
# window segments in status line
set -g window-status-separator ""
separator_powerline_left=""
separator_powerline_right=""
setw -g window-status-style "fg=$color_status_text,bg=$color_dark"
setw -g window-status-format " #I:#W "
#setw -g window-status-current-format "#[fg=$color_dark,bg=$color_dark]$separator_powerline_left#[default] #I:#W# #[fg=$color_main,bg=$color_main]$separator_powerline_right#[default]"
setw -g window-status-current-format "#[fg=$color_main,bg=$color_dark]$separator_powerline_left#[fg=$color_light,bg=$color_main] #I:#W #[fg=$color_main,bg=$color_dark]$separator_powerline_right#[default]"
setw -g window-status-current-style "fg=$color_light,bg=$color_main"
# when window has monitoring notification
setw -g window-status-activity-style "fg=$color_main"
# outline for active pane
setw -g pane-active-border-style "fg=$color_main"
# general status bar settings
set -g status on
set -g status-interval 5
set -g status-position bottom
set -g status-justify left
set -g status-right-length 100
#wg_user_host="#[fg=$color_secondary]#(whoami)#[default]@#H"
#set -g status-left "$wg_session"
#set -g status-right "#{prefix_highlight} $wg_is_keys_off $wg_is_zoomed | $wg_user_host | $wg_date"