-
Notifications
You must be signed in to change notification settings - Fork 1
/
.tmux.conf
229 lines (180 loc) · 8.39 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
set -g default-terminal "screen-256color"
set-option -sa terminal-features ',xterm-256color:RGB'
# set-option -ga terminal-overrides ",*256col*:Tc"
# set-window-option -g alternate-screen on
set -g mouse on
# Start numbering at 1
set -g base-index 1
set-window-option -g pane-base-index 1
# Allows for faster key repetition
set -s escape-time 0
set -g focus-events on
# increase history buffer size
set-option -g history-limit 10000
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on
# enable use of Ctrl+left | Ctrl+right keys
set-window-option -g xterm-keys on
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle # Change to rectangular selection
bind -T copy-mode-vi y send-keys -X copy-pipe 'xclip -in -selection clipboard'
################
# HOTKEYS #
################
# Bind master prefix
unbind C-b
set -g prefix C-o
bind C-o send-prefix
bind-key e set status
# session management
bind-key w choose-session
bind-key R command-prompt -p "Rename session:" "rename-session '%%'"
bind S command-prompt -p "New session name: " "new-session -s '%%'"
bind K choose-session "kill-session -t '%%'"
bind L choose-window "link-window -s '%%'"
# set window split
bind-key v split-window -h -c '#{pane_current_path}'
bind-key s split-window -v -c '#{pane_current_path}'
bind-key c new-window -c '#{pane_current_path}'
# join / split windows
bind-key a choose-window "join-pane -t '%%'"
bind-key A "break-pane"
bind-key o copy-mode
bind-key C-o copy-mode
# Vi copypaste mode
bind V paste-buffer
# hjkl pane traversal
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# change layout
bind-key ] next-layout
bind-key [ previous-layout
bind-key ` last-window
bind-key P swap-window -t -1 \; select-window -t -1
bind-key N swap-window -t +1 \; select-window -t +1
bind-key T command-prompt -p "Move Window To:" "move-window -t '%%'"
bind-key C command-prompt -p "Name of new window:" "new-window -n '%%'"
bind-key r command-prompt -p "Rename window:" "rename-window '%%'"
bind $ source-file ~/.tmux.conf \
bind i command-prompt -p "Popup: " "display-popup -EE -d '#{pane_current_path}' -w80% -h80% 'bash -ic \"%%\"'"
# WINDOW MONITORING
# do not monitor for activity and silence by default
set-window-option -g monitor-activity off
set-window-option -g monitor-silence 0
# do not display messages about silence, bell and activity
set -g visual-activity on
set -g visual-bell off
set -g visual-silence on
# define keys for easy activity/silence monitoring
bind m set-window-option monitor-activity \; display "Toggle monitor activity: #{?monitor-activity,on,off}"
bind-key M command-prompt -p "Monitor seconds of silence (0=off): " "set-window-option monitor-silence '%1' \; display 'Monitoring window for silence: #{?monitor-silence,#{E:monitor-silence} seconds,off}'"
# save buffer to a file
bind-key u command-prompt -p 'Save history to filename:' -I '~/tmux.history' 'capture-pane -S - ; save-buffer %1 ; delete-buffer'
###########################
# COLORS AND FORMATS #
###########################
set -g status-style fg=colour0,bg=default # transparent background
# active window title colors
# set-window-option -g window-status-current-style fg=colour4,bg=default
# pane border
set-option -g pane-border-style fg=colour7
set-option -g pane-active-border-style fg=colour14,bold
# message text
set-option -g message-style fg=colour15,bold,bg=colour0
# pane number display
set-option -g display-panes-active-colour colour0
set-option -g display-panes-colour colour14
set-option -g display-panes-active-colour colour11
# main tmux color used in copy mode
set-window-option -g mode-style bg=colour6,fg=colour0
# window formats
set-window-option -g window-status-separator " "
# window flags (#F):
# # window activity flag
# ! window bell flag
# ~ window silence flag
# * current window flag
# - last window flag
# Z window zoomed flag
# ' ' (a space): no flags at all.
set-window-option -g window-status-format " #{s/Z//:window_flags} #I #W#{?monitor-silence, #{E:monitor-silence},}#{?monitor-activity, ,}#{?window_linked, *,}"
set-window-option -g window-status-current-format " #{s/\\*//:#{s/Z//:window_flags}} #I #W#{?monitor-silence, #{E:monitor-silence},}#{?monitor-activity, ,}#{?window_linked, *,}"
# window styles
set-window-option -g window-status-style fg=colour7,bg=default
set-window-option -g window-status-current-style fg=colour15,bold
#set-window-option -g window-active-style fg=colour15 # change foreground color for active window
set-window-option -g window-status-last-style fg=colour7
set-window-option -g window-status-activity-style fg=colour11,bold
set-window-option -g window-status-bell-style fg=colour9,bold
set-option -g status on
set-option -g status-interval 0
set-option -g status-justify "left"
set-option -g status-left-length 90
set-option -g status-right-length 140
#
set-option -g status-left "#{?#{==:#{SSH_CLIENT},},,#[fg=cyan bold]#H #[bg=default]}" # #[fg=colour3,bold]#{?#S,#S,}"
# set-option -g status-right "#{prefix_highlight} #[fg=colour2]#{battery_icon_status}#{battery_color_charge_fg}#[bg=default]#{battery_percentage} #[fg=colour7]#{uptime} #{date} #[fg=colour14,bold]#{time}"
set-option -g status-right "#{prefix_highlight}\
#[fg=colour7]{ #(tmux ls -F '#[fg=##{?session_alerts,red bold,##{?session_attached,##{?##{==:#{session_id},##{session_id}},yellow bold,cyan bold},colour7 nobold}}]##{?session_alerts,##{session_alerts} ,}##S:##{session_windows}'|paste -sd' ') #[fg=colour7,nobold]}\
#[fg=colour2]#{battery_icon_status}#{battery_color_charge_fg}#[bg=default]#{battery_percentage}\
#[fg=colour7]#{uptime} #[fg=colour0] CPU:#{sysstat_loadavg} #{sysstat_mem}"
############################
# TERMINAL EMULATOR TITLES #
############################
set-option -g set-titles on
set-option -g set-titles-string "#S | #W"
# start with status bar off
# set -g status off
############################
# PLUGINS #
############################
set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.tmux/'
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'MunifTanjim/tmux-suspend'
set -g @plugin 'Morantron/tmux-fingers'
set -g @plugin '3ximus/tmux-plugin-uptime'
set -g @plugin '3ximus/tmux-plugin-datetime'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin '3ximus/tmux-plugin-sysstat'
#########################
# Plugin Config
set -g @suspend_suspended_options " \
status-left-style::bg=colour3\\,fg=colour235 bold dim, \
status-left:: suspended , \
status-right-style::fg=black dim, \
window-status-style:gw:fg=colour7 dim, \
window-status-current-style:gw:fg=colour7 dim, \
"
# set -g @suspend_on_resume_command "tmux set status"
# set -g @suspend_on_suspend_command "tmux set status"
set -g @batt_icon_status_charged ' '
set -g @batt_icon_status_charging '#[fg=green,bold]⚡#[fg=default,default]'
set -g @batt_icon_status_discharging ' '
set -g @batt_icon_status_unknown ' '
set -g @batt_color_charge_primary_tier8 'green,bold'
set -g @batt_color_charge_primary_tier7 'green,bold'
set -g @batt_color_charge_primary_tier6 'green,bold'
set -g @batt_color_charge_primary_tier5 'yellow,bold'
set -g @batt_color_charge_primary_tier4 'yellow,bold'
set -g @batt_color_charge_primary_tier3 'yellow,bold'
set -g @batt_color_charge_primary_tier2 'red,bold'
set -g @batt_color_charge_primary_tier1 'red,bold'
set -g @sysstat_mem_view_tmpl 'RAM:#[fg=#{mem.color}]#{mem.pused}'
set -g @fingers-key C-f
set -g @fingers-hint-style "fg=red,bold"
set -g @fingers-highlight-style "fg=cyan"
set -g @fingers-pattern-1 '["].*["]' # match quoted text, useful when files path are quoted
set -g @fingers-pattern-2 "['][^']+[']" # match quoted text, useful when files path are quoted
# generic URL matcher
set -g @fingers-pattern-3 "([a-z][a-z0-9+\-.]*)://(([a-zA-Z0-9._~%!\$&()*+,;=\-]+)?:?([a-zA-Z0-9._~%!\$&()*+,;=\-]+)?@)?([a-z0-9._~%\-]+|\[[a-f0-9:.]+\]|\[v[a-f0-9][a-z0-9._~%!\$&()*+,;=:\-]+\])(:[0-9]+)?(/[a-zA-Z0-9._~%!\$&()*+,;=:@\-]+)*/?"
# pattern for jira tickets
set -g @fingers-pattern-2 "[A-Z][A-Z0-9_]*-[0-9]+"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/tpm/tpm'