Repository navigation
Expand file tree
/
Copy pathtmux.conf
More file actions
246 lines (197 loc) Β· 9.14 KB
/
Copy pathtmux.conf
File metadata and controls
246 lines (197 loc) Β· 9.14 KB
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
# reset tmux keybindings
source-file ~/.config/tmux/tmux.reset.conf
# remap prefix from 'C-b' to '`'
unbind C-b
# =============================================
# GLOBALS
# =============================================
prompt='σ± ξ'
set-option -g prefix C-a
set -g default-terminal "tmux-256color"
set -g terminal-overrides ",xterm-256color:RGB"
set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
set -g cursor-style blinking-bar
set -g default-terminal "${TERM}"
set -ga terminal-overrides ",*256col*:Tc"
# setenv -g COLORTERM truecolor
# set -g default-shell /opt/homebrew/bin/fish
set -g detach-on-destroy off
set -g focus-events on
set -g set-clipboard on # use system clipboard
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
# fix SSH agent after reconnecting
# see also ssh/rc
# https://blog.testdouble.com/posts/2016-11-18-reconciling-tmux-and-ssh-agent-forwarding/
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock
setenv -g GNUPGHOME $HOME/.gnupg
# very large history
set -g history-limit 30000
set -g base-index 1
setw -g pane-base-index 1
set -gs escape-time 0
set -g -q mouse on
setw -g mode-keys vi
# don't rename windows automatically
# set -g allow-rename off
set -g renumber-windows on
# =============================================
# BINDINGS
# =============================================
bind c new-window -c "#{pane_current_path}"
bind - split-window -c "#{pane_current_path}"
bind '|' split-window -h -c "#{pane_current_path}"
unbind %
unbind '"'
unbind l
unbind-key p
bind u copy-mode\; send-keys -X start-of-line\; send-keys -X search-backward '#{prompt}' \; send-keys -X jump-backward '#{prompt}'\; send-keys -X next-space \; send-keys -X cursor-right
# source .tmux.conf with r
bind r source-file ~/.config/tmux/tmux.conf
bind f display-popup -s "bg=${thm_bg_dark}" -E -w70% -h70% -d '#{pane_current_path}' "lf"
bind g new-window -c "#{pane_current_path}" lazygit
bind h run-shell "tmux switch-client -t mono || tmux new-session -d -s mono -c '$HOME/code/komodor/mono' && tmux switch-client -t mono"
bind G run-shell "tmux switch-client -t gh-dash || tmux new-session -d -s gh-dash -c '$HOME/code/dlvhdr/gh-dash' gh dash && tmux switch-client -t gh-dash"
bind M run-shell "tmux switch-client -t mprocs || tmux new-session -d -s mprocs -c '$HOME' 'mprocs -c ~/.config/mprocs/mprocs.yaml' && tmux switch-client -t mprocs"
bind m new-window woman
bind k display-popup -s "bg=${thm_bg_dark}" -w 50% -h 50% -E -T "Kill session" "choose_session_multi.sh | xargs -I_ tmux kill-session -t _"
bind P display-message -F "#{pane_current_path}"
bind S choose-session
bind "?" display-popup -E -w70% -h70% "keyb -c ~/.config/keyb/config.yml -k ~/.config/keyb/keyb.yml"
# bind "," run-shell -b "fish -c 'cd $XDG_CONFIG_HOME/tmux && ./open-dotfiles.fish'"
bind "," run-shell -b "fish -c 'cd $XDG_CONFIG_HOME/tmux && ./open-dotfiles.fish'"
# mouse support
bind -n WheelUpPane copy-mode -e
# vim
bind-key -T copy-mode-vi Enter send -X copy-selection-and-cancel
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-no-clear
bind-key -T copy-mode-vi M-h resize-pane -L 1
bind-key -T copy-mode-vi M-j resize-pane -D 1
bind-key -T copy-mode-vi M-k resize-pane -U 1
bind-key -T copy-mode-vi M-l resize-pane -R 1
bind-key -T copy-mode-vi u send-keys -X start-of-line\; send-keys -X search-backward 'σ± ξ'\; send-keys -X clear-selection\; send-keys -X next-space\; send-keys -X cursor-right
bind-key -T copy-mode-vi d send-keys -X start-of-line\; send-keys -X search-forward 'σ± ξ'\; send-keys -X clear-selection\; send-keys -X next-space\; send-keys -X cursor-right
# window control
bind-key ";" last-window
bind-key "'" switch-client -l
bind-key z resize-pane -Z
bind C-f copy-mode \; command-prompt -p "(search up)" "send -X search-backward \"%%%\""
# swap window to left or right
bind-key -r < swap-window -d -t -1
bind-key -r > swap-window -d -t +1
# resize panes
bind -r H resize-pane -L 1
bind -r J resize-pane -D 1
bind -r K resize-pane -U 1
bind -r L resize-pane -R 1
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-M-h if-shell "$is_vim" "send-keys M-h" "resize-pane -L 1"
bind-key -n C-M-j if-shell "$is_vim" "send-keys M-j" "resize-pane -D 1"
bind-key -n C-M-k if-shell "$is_vim" "send-keys M-k" "resize-pane -U 1"
bind-key -n C-M-l if-shell "$is_vim" "send-keys M-l" "resize-pane -R 1"
# bind-key x if-shell "$is_vim" 'send-keys :quitall! Enter ; run-shell "while $is_vim do sleep 0.1 done"; kill-pane' 'kill-pane'
# fzf-speed
bind-key Tab capture-pane \; save-buffer /tmp/tmux-buffer \; delete-buffer \; display-popup -w 80% -h 60% -E "fzf-speed"
bind x run-shell " \
if [ #{session_windows} -eq 1 ] && \
[ #{window_panes} -eq 1 ] ; then \
if [ \$(tmux list-sessions | wc -l) -ge 2 ]; then \
tmux switch-client -l; \
fi; tmux kill-session -t \"#S\"; \
else \
tmux kill-pane; \
fi; \
"
# =============================================
# Styles
# =============================================
thm_bg="default"
thm_bg_dark="default"
thm_fg="#c0caf5"
thm_gray="#9499b8"
thm_magenta="#bb9af7"
thm_pink="#ff007c"
thm_green="#9ece6a"
thm_blue="#2ac3de"
thm_black4="#414868"
thm_yellow="#e0af68"
thm_selected="#364a82"
thm_match="#3d59a1"
set-option -g set-titles on
set-option -g set-titles-string "#S / #W"
set-option -gw pane-border-indicators 'arrows'
setw -g window-status-format "#[fg=${theme_gray}]#I #W"
setw -g window-status-current-format "#[fg=${thm_green},bold]#I #W"
setw -g window-status-separator "#[fg=#565f89] β "
set -g pane-active-border-style "fg=magenta,bg=default"
set -g pane-border-style "fg=white,bg=default"
set -g popup-border-style "fg=#{thm_gray},bg=${thm_bg_dark}"
set -g popup-border-lines rounded
set -g copy-mode-match-style "bg=#3d59a1"
set -g copy-mode-current-match-style "fg=${thm_bg_dark},bg=${thm_yellow}"
set -g mode-style "bg=${thm_selected}"
set -g status "on"
set -g status-style 'fg=white'
set -g status-position top
set -g status-left-length 50
set -g status-left "#[fg=#{?client_prefix,${thm_yellow},${thm_fg}},bg=${thm_bg_dark}]#S#[fg=${thm_fg},bg=default] βΈ " # session name
set -g status-right-length 0
set -g status-right ""
# set -g status-right "#[fg=${thm_gray}][ο #{client_last_session}]"
set -g status-justify left
set -g status-interval 3
set -g message-style fg="${thm_yellow}",bg="${thm_bg_dark}",align="centre"
set -g message-command-style fg="${thm_blue}",bg="${thm_gray}",align="centre"
# set terminal title
set -g set-titles on
set -g set-titles-string "#S / #W"
set -ga update-environment FZF_DEFAULT_OPTS
# bind prefix C-l send-keys to clear-history
bind C-l send-keys C-l
bind M-C-l send-keys C-l \; run 'sleep 0.05 && tmux clear-history'
set-window-option -g window-active-style "fg=${thm_fg}"
set-window-option -g window-style "fg=${thm_gray}"
bind-key "T" run-shell "sesh connect \"$(
sesh list -tz | fzf-tmux -p 55%,60% \
--no-sort --border-label ' sesh ' --prompt 'β‘ ' \
--header ' ^a all ^t tmux ^x zoxide ^f find' \
--bind 'tab:down,btab:up' \
--bind 'ctrl-a:change-prompt(β‘ )+reload(sesh list)' \
--bind 'ctrl-t:change-prompt(ξ― )+reload(sesh list -t)' \
--bind 'ctrl-x:change-prompt(ο )+reload(sesh list -z)' \
--bind 'ctrl-f:change-prompt(ξ© )+reload(fd -H -d 2 -t d -E .Trash . ~)'
)\""
bind-key "p" run-shell "/Users/dlvhdr/code/playground/tmux-sticky-scroll/main.tmux"
# ==========================================
# PLUGINS
# ==========================================
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'joshmedeski/tmux-fzf-url'
set -g @fzf-url-fzf-options '-p 60%,30% --prompt="ο " --border-label=" Open URL "'
set -g @fzf-url-history-limit '2000'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-dir "$XDG_DATA_HOME/tmux/resurrect".
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'off'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @emulate-scroll-for-no-mouse-alternate-buffer "on"
set -g @plugin 'mskelton/tmux-last'
set -g @tmux-last-prompt-pattern 'σ± ξ'
set -g @tmux-last-key C
set -g @tmux-last-prompt-lines 2
# set -g @tmux-last-pager "bat --paging=always -n -f"
set -g @tmux-last-pager "less +g -~ -r"
set -g @tmux-last-color on
set -g @plugin 'RyanMillerC/better-vim-tmux-resizer'
set -g @plugin 'Morantron/tmux-fingers'
set -g @fingers-hint-style 'fg=colour0,bg=colour3'
set -g @plugin 'joshmedeski/tmux-nerd-font-window-name'
# set -g @plugin 'noscript/tmux-mighty-scroll'
run '~/.config/tmux/plugins/tpm/tpm'