/
tmux.conf
214 lines (161 loc) · 5.72 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
##############################################################################
# @file tmux.conf
# @date May, 2015
# @author G. Roggemans <g.roggemans@grog.be>
# @copyright Copyright (c) GROG [https://grog.be] 2015, All Rights Reserved
# @license MIT
##############################################################################
# Do not use default bindings
unbind -a
##############################################################################
# General settings
# Set shell
set -g default-shell $SHELL
# Use 256 colors
set -g default-terminal "screen-256color"
# Start numbering from 1
set -g base-index 1
setw -g pane-base-index 1
# Renumber after closing window
set -g renumber-windows on
# Enable focus events
set -g focus-events on
# Address vim mode switching delay
set -s escape-time 0
# Set scrollback history
set -g history-limit 50000
# Border colors
set -g pane-border-style fg=colour236,bg=colour233
set -g pane-active-border-style fg=colour25,bg=colour233
##############################################################################
# Disable mouse support
#set -g mouse-utf8 off
#setw -g mode-mouse off
#set -g mouse-select-pane off
#set -g mouse-resize-pane off
#set -g mouse-select-window off
##############################################################################
# Status bar settings
# Enable status bar
set -g status on
# Update every 5 seconds
set -g status-interval 5
# Show messages for 3 seconds
set -g display-time 3000
# Show activity
setw -g monitor-activity on
# Prevent activity message
set -g visual-activity off
# Colors
set -g status-style fg=colour240,bg=colour233
# Message/command
set -g message-style fg=colour195,bg=colour236
# Window tab
set -g status-justify centre
setw -g window-status-style fg=colour145,bg=colour236
setw -g window-status-format " #I: #W "
# Current window tab
setw -g window-status-current-style fg=colour195,bg=colour25
setw -g window-status-current-format " #I: #W "
# Window tab with activity
setw -g window-status-activity-style fg=colour166,bg=colour232
# Left section
set -g status-left-length 90
setw -g status-left-style fg=colour145,bg=colour236
setw -g status-left "#[fg=colour195]#[bg=colour25] #h #[default] \
#S #[bg=colour233] "
# Right section
set -g status-right-length 90
setw -g status-right-style fg=colour145,bg=colour236
setw -g status-right "#[bg=colour233] #[default] \
C:#{cpu_percentage}% M:#{mem_percentage}% B:#{battery_percentage}% \
#{online_status} #[fg=colour195]#[bg=colour25] %H:%M \
#[fg=default]#(TZ=UTC date +'%'H) "
##############################################################################
# Fixed key bindings
# Change prefix key
set -g prefix C-a
bind C-a send-prefix
# Vim style navigation in copy mode
setw -g mode-keys vi
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi r send-keys -X rectangle-toggle
bind -T copy-mode-vi y send-keys -X copy-selection
bind -T copy-mode-vi Y send-keys -X copy-end-of-line
bind p paste-buffer
# Fast reloading of tmux.conf
bind R source "$HOME/.tmux.conf"
# Bind command prompt (also `Alt` + `;` for faster commands)
bind : command-prompt
bind -n M-\; command-prompt
# List keys
bind ? list-keys
# Suspend client
bind s suspend-client
# "Visual" mode (copy-mode)
bind v copy-mode
# Vim style pane resizing
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
# Smart pane switching with awareness of vim splits
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
#bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Alternative pane switching for nested tmux sessions
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
#bind \ select-pane -l
# Window controls
bind t new-window
bind x kill-pane
bind X kill-window
bind / command-prompt "find-window '%%'"
# Jump to window
bind -n M-1 select-window -t :1
bind -n M-2 select-window -t :2
bind -n M-3 select-window -t :3
bind -n M-4 select-window -t :4
bind -n M-5 select-window -t :5
bind -n M-6 select-window -t :6
bind -n M-7 select-window -t :7
bind -n M-8 select-window -t :8
bind -n M-9 select-window -t :9
##############################################################################
# Dynamic key bindings
# Load Function key bindings
source "$HOME/.config/tmux/f-keys.tmux"
# Option to load byobu function key bindings
bind b source "$HOME/.config/tmux/byobu.f-keys.tmux"
# Option to load default key bindings
bind d source "$HOME/.config/tmux/default.tmux"
##############################################################################
# Plugins
set -g @plugin 'tmux-plugins/tmux-logging'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-online-status'
set -g @plugin 'GROG/tmux-plugin-cpu'
set -g @plugin 'GROG/tmux-plugin-mem'
set -g @plugin 'GROG/tmux-plugin-battery'
##############################################################################
# Plugins settings
# tmux-online-status
#
set -g @online_icon "#[fg=colour10]|-\-\-|"
set -g @offline_icon "#[fg=colour9]|-/-|"
##############################################################################
# Local config
if-shell "[ -f $HOME/.local/tmux/tmux.conf ]" "source $HOME/.local/tmux/tmux.conf"
##############################################################################
# Plugin manager
# Run plugin manager
run-shell 'ellipsis-tpm run'
# Set plugin path
set -g @tpm_plugin_path "$HOME/.config/tmux/plugins"
##############################################################################