forked from theniceboy/.config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
261 lines (217 loc) · 7.55 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
249
250
251
252
253
254
255
256
257
258
259
260
261
# cat << EOF > /dev/null
# -- general
setw -g xterm-keys on
set -s escape-time 0
set -sg repeat-time 300
set -s focus-events on
set -g mouse on
set -sg exit-empty on
set -q -g status-utf8 on
setw -q -g utf8 on
set -g visual-activity off
setw -g monitor-activity off
setw -g monitor-bell off
set -g history-limit 10000
set-hook -g pane-focus-in "run -b 'bash ~/.config/tmux/fzf_panes.tmux update_mru_pane_ids'"
bind -n M-w run -b 'bash ~/.config/tmux/fzf_panes.tmux new_window'
# reload configuration
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
set -ga update-environment '\
DISPLAY DBUS_SESSION_BUS_ADDRESS \
QT_IM_MODULE QT_QPA_PLATFORMTHEME \
SESSION_MANAGER \
XDG_CONFIG_HOME XDG_CACHE_HOME XDG_DATA_HOME\
XDG_MENU_PREFIX XDG_RUNTIME_DIR XDG_SESSION_CLASS \
XDG_SESSION_DESKTOP XDG_SESSION_TYPE XDG_CURRENT_DESKTOP \
XMODIFIERS \
FZF_DEFAULT_OPTS \
'
set-hook -g client-attached 'run -b "cut -c3- ~/.tmux.conf | sh -s update_env_event"'
# -- prefix
unbind C-b
set -g prefix 'C-s'
# -- display
set -g base-index 1
setw -g pane-base-index 1
setw -g automatic-rename on
set -g renumber-windows on
set -g set-titles on
set -g display-panes-time 2000
set -g display-time 2000
set -g status-interval 1
# -- navigation
# create session
bind C-c new-session
# window management
bind -n M-o new-window -c "#{pane_current_path}"
bind -n M-O break-pane
bind -n M-Q kill-pane
# window navigation
unbind n
unbind p
unbind 1
unbind 2
unbind 3
unbind 4
unbind 5
unbind 6
unbind 7
unbind 8
unbind 9
unbind 0
bind -r C-p previous-window
bind -r C-n next-window
bind u split-window -vb -c "#{pane_current_path}"
bind e split-window -v -c "#{pane_current_path}"
bind n split-window -hb -c "#{pane_current_path}"
bind i split-window -h -c "#{pane_current_path}"
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
bind -n M-! join-pane -t :1
bind -n M-@ join-pane -t :2
bind -n 'M-#' join-pane -t :3
bind -n 'M-$' join-pane -t :4
bind -n M-% join-pane -t :5
bind -n M-^ join-pane -t :6
bind -n M-& join-pane -t :7
bind -n M-* join-pane -t :8
bind -n M-( join-pane -t :9
bind -n M-f resize-pane -Z
# pane navigation
bind 1 select-pane -t:.1
bind 2 select-pane -t:.2
bind 3 select-pane -t:.3
bind 4 select-pane -t:.4
bind 5 select-pane -t:.5
bind 6 select-pane -t:.6
bind 7 select-pane -t:.7
bind 8 select-pane -t:.8
bind 9 select-pane -t:.9
bind 0 select-pane -t:.10
bind -n M-n select-pane -L
bind -n M-e select-pane -D
bind -n M-u select-pane -U
bind -n M-i select-pane -R
bind > swap-pane -D
bind < swap-pane -U
bind | swap-pane
bind -n M-Space next-layout
bind W choose-tree -Z
bind S choose-tree 'move-pane -v -s "%%"'
bind V choose-tree 'move-pane -h -s "%%"'
# pane resizing
bind -n M-N resize-pane -L 3
bind -n M-E resize-pane -D 3
bind -n M-U resize-pane -U 3
bind -n M-I resize-pane -R 3
set -g status-keys emacs
set -g mode-keys vi
bind -n M-v copy-mode
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind -T copy-mode-vi n send-keys -X cursor-left
bind -T copy-mode-vi i send-keys -X cursor-right
bind -T copy-mode-vi u send-keys -X cursor-up
bind -T copy-mode-vi e send-keys -X cursor-down
bind -T copy-mode-vi h send-keys -X next-word-end
bind -T copy-mode-vi U send-keys -N 5 -X cursor-up
bind -T copy-mode-vi E send-keys -N 5 -X cursor-down
bind -T copy-mode-vi N send-keys -X start-of-line
bind -T copy-mode-vi I send-keys -X end-of-line
bind -T copy-mode-vi Y send-keys -X copy-end-of-line
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind -T copy-mode-vi = send-keys -X search-again
bind -T copy-mode-vi = send-keys -X search-reverse
bind b list-buffers
bind p paste-buffer
# -- toggle_syn_input
bind C-g if-shell '[[ $(tmux showw synchronize-panes | cut -d\ -f2) == "on" ]]' \
'setw synchronize-panes off; set -g pane-border-style fg=magenta' \
'setw synchronize-panes on; set -g pane-border-style fg=red'
# -- toggle_status
bind s if-shell '[[ $(tmux show -g status | cut -d\ -f2) == "on" ]]' \
'set -g status off' \
'set -g status on'
# -- fzf_url
bind l run -b 'cut -c3- ~/.tmux.conf | sh -s fzf_url'
run 'cut -c3- ~/.tmux.conf | sh -s bind_with_sys_clipboard'
# -- theme
#set -g status off
# panes
#setw -g pane-border-status bottom
setw -g pane-border-format '#[bold]#{?#{&&:#{pane_active},#{client_prefix}},#[underscore],}\
#{?pane_active,❐ #S:#I/#{session_windows} ,}#{?window_zoomed_flag,⬢,❄} #P ⇒ #{pane_tty} #{pane_current_command}'
#set -g pane-active-border-style fg=brightblue
#set -g pane-border-style fg=magenta
# windows
set -g status-justify 'centre'
set -g status-left-length 90
set -g status-right-length 140
setw -g window-status-separator ''
# default statusbar colors
set -g status-bg black
#set -g status-left ' #[fg=magenta,bold]❐ #S'
#set -g status-left '#[fg=brightyellow] #{?client_prefix,⌨ , } #[fg=magenta,bold] %Y-%m-%d %H:%M '
#set -g status-right '#(rainbarf --battery --remaining --bolt --tmux --rgb)'
#set -g status-left "#[fg=magenta,bold] %Y-%m-%d %H:%M | #[fg=brightblue]#(curl icanhazip.com) #(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #(ifconfig en3 | grep 'inet ' | awk '{print \"en3 \" $2}') #(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') "
setw -g window-status-format '#[fg=brightblue] #I #W '
setw -g window-status-current-format '#[fg=magenta,bold] #I #W:#F'
setw -g window-status-activity-style bg=black
setw -g window-status-bell-style bg=black
#set-window-option -g window-status-current-format "#[fg=colour235, bg=colour27]⮀#[fg=colour255, bg=colour27] #I ⮁ #W #[fg=colour27, bg=colour235]⮀"
set-option -g status-left "#(~/.config/tmux/tmux-powerline/powerline.sh left)"
set-option -g status-right "#(~/.config/tmux/tmux-powerline/powerline.sh right)"
run-shell ~/.config/tmux/extrakto/extrakto.tmux
#set-option -g status-utf8 on
#set -g status-left '#(rainbarf --battery --remaining --bolt --rgb)'
set-option default-path "$PWD"
# EOF
# bind_with_sys_clipboard() {
# if [[ -x $(command -v xsel) ]]; then
# cmd='xsel -i -b'
# elif [[ -x $(command -v xclip) ]]; then
# cmd='xclip -i -selection clipboard'
# fi
# if [[ -n $cmd ]]; then
# while IFS= read -r line; do
# [[ -z $line ]] && continue
# bind_key=$(printf '%s' "$line" |
# sed -E "s/copy-selection(-and-cancel)?$/copy-pipe\1 \"$cmd\"/g")
# eval "tmux $bind_key"
# done <<< $(tmux list-keys | grep -E 'copy-selection|copy-pipe')
# fi
# }
#
# fzf_url() {
# local ip4_seg="(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"
# local path_set="[-a-zA-Z0-9@:%_\+\.~#?&//=]"
# local url_re="(https?|ftp|file)://($path_set+|(($ip4_seg\.){3,3}$ip4_seg$path_set*))"
# local -a url=($(tmux capture-pane -S - -Jp | grep -oE "$url_re"))
# if [[ -z $url ]]; then
# return 0
# else
# printf "%s\n" ${url[@]} |
# sort -u |
# nl -w3 -s ' ' |
# fzf-tmux -d 25% --multi --exit-0 --cycle --reverse |
# awk '{print $2}' |
# xargs -I {} xdg-open {} &> /dev/null
# fi
# }
#
# update_env_event() {
# local event='client-attached'
# local event_dir=${TMUX%%,*}-event
# mkdir -p $event_dir 2>/dev/null
# rm $event_dir/$event-pane* 2>/dev/null
# tmux list-panes -a -F '#D' | sed -E "s|^(.*)$|$event_dir/$event-pane-\1|g" | xargs touch
# }
#
# "$@"