-
Notifications
You must be signed in to change notification settings - Fork 8
/
tmux.conf
212 lines (188 loc) · 10.1 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
#################################################################################
## ##
## ████████╗███╗ ███╗██╗ ██╗██╗ ██╗ ██████╗ ██████╗ ███╗ ██╗███████╗ ##
## ╚══██╔══╝████╗ ████║██║ ██║╚██╗██╔╝ ██╔════╝██╔═══██╗████╗ ██║██╔════╝ ##
## ██║ ██╔████╔██║██║ ██║ ╚███╔╝ ██║ ██║ ██║██╔██╗ ██║█████╗ ##
## ██║ ██║╚██╔╝██║██║ ██║ ██╔██╗ ██║ ██║ ██║██║╚██╗██║██╔══╝ ##
## ██║ ██║ ╚═╝ ██║╚██████╔╝██╔╝ ██╗██╗╚██████╗╚██████╔╝██║ ╚████║██║ ##
## ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ##
## $#
#################################################################################
# misc. {{{
set-option -g default-shell "/opt/local/bin/zsh"
# set-option -g default-command "/opt/local/bin/reattach-to-user-namespace -l $SHELL"
set-option -sg default-terminal "tmux-256color"
set-option -ga terminal-overrides ",*256col*:Tc"
set-option -sa terminal-overrides ",xterm-kitty:Tc"
set-option -as terminal-features ',xterm-kitty:RGB'
set-option -as terminal-features ',xterm-kitty:usstyle'
set-option -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
set-option -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set-option -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours
# set -s extended-keys on
# set -as terminal-overrides '*:Eneks=\E[>4;1m'
# set -as terminal-overrides '*:Dseks=\E[>4;m'
# set -as terminal-features 'xterm*:extkeys'
set-option -sg escape-time 30
set-option -g focus-events on
set-option -g mouse on
set-option -g status-keys vi
set-option -g set-clipboard on
set-option -g history-limit 50000
set-option -g focus-events on
set-option -g display-time 5000
set-option -g allow-passthrough on
set-option -wgq utf8 on
set-option -wg monitor-activity on
set-option -wg mode-keys vi
set-option -wg automatic-rename on
#set-option -wg xterm-keys on
# }}}
# command-message-status-style {{{
# set -g message-style 'bg=#282828,fg=yellow,bold'
set -g message-style 'bg=default,fg=yellow,bold'
# set -g status-style 'bg=#282828'
set -g status-style 'bg=default'
# }}}
# Titles {{{
set -g set-titles on
set -g set-titles-string '#{window_index}.#{pane_index} ☞ #{pane_current_command}'
# }}}
# pane-borders {{{
# set -g pane-border-status top
%if "#{!=:$SSH_CONNECTION,}"
set -gF pane-border-style '#{?pane_synchronized,fg=red,fg=blue}'
set -gF pane-active-border-style '#{?pane_synchronized,fg=brightred,fg=yellow}'
%else
set -gF pane-border-style '#{?pane_synchronized,fg=red,fg=white}'
set -gF pane-active-border-style '#{?pane_synchronized,fg=brightred,fg=green}'
%endif
set -g pane-border-format "(#{pane_index}) #{pane_title} → #{pane_current_command}"
# }}}
# mode style {{{
# setw -g mode-style 'bg=green, fg=colour232, bold'
setw -g mode-style 'bg=green, fg=black, bold'
# }}}
# status line {{{
set -g status-interval 4
set -g status-position bottom
# Powerline glyphs:
# status right {{{
# TMUX_PANE_CURRENT_PATH='#(tmux display-message -p "#{pane_current_path}" | sed "s#$HOME#~#g")'
# TMUX_PANE_CURRENT_PATH_var='#(tmuxcurpath=$(tmux display-message -p "#{pane_current_path}" | sed "s#$HOME#~#g"); \
# winwidth=$(tmux display-message -p "#{window_width}"); \
# winoverflow=$(echo "${#tmuxcurpath} > $winwidth * 0.4" | bc); \
# [[ $winoverflow -eq 1 ]] && echo "$tmuxcurpath" | perl -pE "s|(/.)[^/]*(?![^/]*$)|\1|g"; \
# [[ $winoverflow -eq 1 ]] || echo "$tmuxcurpath")'
# set -g status-right "#[bg=default,fg=white]$TMUX_PANE_CURRENT_PATH_var "
TMUX_PANE_HOME_SHORTENED_PATH="#{s|\\$HOME|~|:pane_current_path}" # replace $HOME with ~ in current_path
%hidden PANE_ALL_SHORTENED_PATH="#{s|(/.)[^/]*|\\1|:$TMUX_PANE_HOME_SHORTENED_PATH}" # transform [~]/aaa/bbbb/ccc to [~]/a/b/c
%hidden PANE_CUR_DIR="#{b:pane_current_path}" # get current directory name (e.g. ccc)
%hidden PANE_SHORTENED_PATH="#{s|/[^/]*$|/$PANE_CUR_DIR|:$PANE_ALL_SHORTENED_PATH}" # transform [~]/a/b/c to [~]/a/b/ccc
%hidden PATH_LEN='#(tmux display-message -p "#{T:TMUX_PANE_HOME_SHORTENED_PATH}" |wc -c)' # get number of charactes in path
%hidden PATH_OVERFLOW="#{e|>:$PATH_LEN,#{e|*|f:#{window_width},0.4}}" # check if path len is > 0.4*{window_width}
#{s|/[^/]*$|#{s|.*(/[^/]*$)|\\1|:pane_current_path}|:#{s|(/.)[^/]*|\\1|:#{s|\\$HOME|~|:pane_current_path}}} "
set -g status-right "#[bg=default,fg=brightblue] #{?$PATH_OVERFLOW,$PANE_SHORTENED_PATH,$TMUX_PANE_HOME_SHORTENED_PATH} "
set -ga status-right "#[fg=brightblack]#U@#[bold]#H #{online_status}"
set -g status-right-length 150
# memcpu $TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load
# cpu {cpu_fg_color}#{cpu_percentage}#{cpu_icon}
# }}}
# statusline plugins {{{
set -g @online_icon "#[fg=brightgreen,none] #[default]"
set -g @offline_icon "#[fg=red,none] #[default]"
# }}}
# status left {{{
set -g status-left '#[fg=black,bold,bg=green]#{pane_mode}#[fg=green,none]'
set -ga status-left '#{?client_prefix,#[bg=#d65c0d],#[bg=default]} #[fg=brightwhite,bold]#S#[fg=none] '
set -ga status-left '#[bg=default]#{?client_prefix,#[fg=#d65c0d] ,#[fg=default] }'
set -g status-left-length 80
# }}}
# }}}
# Windows status {{{
setw -g window-status-activity-style fg=yellow
setw -g window-status-bell-style fg=red
setw -g window-status-format "#[fg=yellow]#I#[fg=green]#F #[fg=white]#W"
setw -g window-status-current-format "#[fg=brightyellow]#I#[fg=brightgreen]#F #[fg=brightwhite,bold,underscore]#W"
setw -g window-status-separator "#[fg=brightwhite,bold] "
# setw -g window-status-last-style default
# setw -g window-status-current-style
# setw -g window-status-style
set -g status-justify left
# }}}
# List of plugins {{{
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-pain-control'
# set -g @plugin 'Morantron/tmux-fingers'
# set -g @plugin 'tmux-plugins/tmux-copycat'
# set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @plugin 'soyuka/tmux-current-pane-hostname'
set -g @plugin 'tmux-plugins/tmux-online-status'
set -g @plugin 'jaclu/tmux-menus'
# set -g @plugin 'laktak/extrakto'
# set -g @plugin 'CrispyConductor/tmux-copy-toolkit'
# set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g @plugin 'tmux-plugins/tmux-sessionist'
# set -g @plugin 'thewtex/tmux-mem-cpu-load'
# set -g @plugin 'tmux-plugins/tmux-open'
# set -g @plugin 'tmux-plugins/tmux-sidebar'
# set -g @plugin 'jbnicolai/tmux-fpp'
# set -g @plugin 'tmux-plugins/tmux-cpu'
# }}}
# plugin options {{{
set -g @emulate-scroll-for-no-mouse-alternate-buffer "on"
set -g @scroll-speed-num-lines-per-scroll "1"
set -g @menus_trigger 'C-\'
# }}}
# Key-Bindings {{{
set -g prefix C-a
bind C-a send-prefix
unbind '"'
unbind %
unbind C-b
unbind -T copy-mode-vi MouseDragEnd1Pane
unbind -T copy-mode-vi y
# tmux controls
bind-key r source-file ~/.tmux.conf \; display-message "tmux reloaded!"
bind-key T command-prompt -p "New pane title:" 'select-pane -T "%%"'
bind-key F2 setw synchronize-panes \; display-message "#{?pane_synchronized,Panes Synchronized,Panes Free}"\; \
set -gF pane-border-style "$TMUX_PANE_BORDER_STYLE"\; \
set -gF pane-active-border-style "$TMUX_PANE_ACTIVE_BORDER_STYLE"
bind-key C-t setw pane-border-status
bind-key @ display-panes \; command-prompt -p "Move pane to (v):" "move-pane -v -t '%%'"
bind-key C-@ display-panes \; command-prompt -p "Move pane to (h):" "move-pane -h -t '%%'"
# Window swapping
bind-key a last-window
bind-key C-p previous-window
bind-key C-n next-window
bind-key Enter popup -E -d "#{pane_current_path}" $SHELL
bind-key M-Enter split-window -v
# Copy mode bindings
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" \; display-message "highlighted selection copied to system clipboard"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy" \; display-message "highlighted selection copied to system clipboard"
bind-key -T copy-mode-vi v send-keys -X begin-selection
# Navigate to previous/next prompt
bind-key -T copy-mode-vi [ send-keys -X start-of-line \; send-keys -X search-backward "❯"
bind-key -T copy-mode-vi ] send-keys -X start-of-line \; send-keys -X search-forward "❯"
# TODO: chack https://github.com/aleclearmind/nested-tmux
# bind -T root F12 \
# set prefix None \;\
# set key-table off \;\
# set status-style "fg=$color_status_text,bg=$color_window_off_status_bg" \;\
# set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\
# set window-status-current-style "fg=$color_dark,bold,bg=$color_window_off_status_current_bg" \;\
# if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
# refresh-client -S \;\
# bind -T off F12 \
# set -u prefix \;\
# set -u key-table \;\
# set -u status-style \;\
# set -u window-status-current-style \;\
# set -u window-status-current-format \;\
# refresh-client -S
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.tmux/plugins/tpm/'
run '~/.tmux/plugins/tpm/tpm'
# vim:set et sw=4 ts=4 fdm=marker: