-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.tmux.conf
More file actions
244 lines (199 loc) · 9.08 KB
/
Copy path.tmux.conf
File metadata and controls
244 lines (199 loc) · 9.08 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
# set ctrl space as command
unbind C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix
# if-shell "test -f ~/.tmux/tmuxline_theme.sh" "source ~/.tmux/tmuxline_theme.sh"
set -g @plugin 'dracula/tmux'
set -g @dracula-border-contrast true
set -g @dracula-show-powerline true
set -g @dracula-show-empty-plugins false
set -g @dracula-show-edge-icons true
set -g @dracula-show-left-icon "#S #{pane_id}"
set -g @dracula-show-ssh-only-when-connected true
set -g @dracula-plugins "cpu-usage ram-usage ssh-session"
set -g @plugin 'kristopolous/tmux-gentrify'
# - `<prefix> Alt-x`: Cut a pane (marks it and breaks it off)
# - `<prefix> Alt-v`: Paste the cut pane into the current window
# some stuff
set -s set-clipboard on
set -g default-terminal "tmux-256color"
# set -g default-terminal 'screen-256color'
set -g history-limit 100000
set-option -g set-titles on
set-option -g set-titles-string "tmux:#S #W #T"
# set-option -g default-shell /bin/bash
set -g extended-keys on
set-option -g default-shell /bin/zsh
set-option -g detach-on-destroy off
set-option -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY PATH"
setw -g aggressive-resize on
# enable clicking
set -g mouse on
set -s escape-time 0
# split panes using | and -
bind c new-window -c "#{pane_current_path}"
bind ü split-window -h -c "#{pane_current_path}"
bind ö split-window -v -c "#{pane_current_path}"
bind > split-window -h -c "#{pane_current_path}"
bind < split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
bind Escape copy-mode
bind p paste-buffer
bind -n M-ú paste-buffer
bind ő copy-mode # map [ to the place it would be on English keyboards
bind -n M-ő copy-mode
bind -T copy-mode-vi v send -X begin-selection
bind ú paste-buffer ## map ] to the place it would be on English keyboards
setw -g mode-keys vi
###########################
# Plugins
###########################
# To install plugins:
# 1) Add plugin down here
# 2) Prefix + I to install plugin
# To update plugins:
# 1) Prefix + U
# To remove plugins:
# 1) Remove line down here
# 2) Prefix + ALT + U
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-capture-pane-contents 'on'
# opencode: inline strategy ("->") relaunches it with -c so a restore continues
# the last session instead of starting fresh; --port 0 keeps the server exposed.
set -g @resurrect-processes 'vim nvim man less htop claude "~opencode->opencode -c --port 0" ~confed ~ipython'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-save-interval '1'
set -g @continuum-restore 'on'
# set -g @continuum-boot 'on'
set -g @resurrect-restore 'R'
set -g @resurrect-save 'S'
# Keep pane-float-zoom's hidden "zoomfloat" session out of saved state so a
# mid-flight zoom can't get resurrected across a tmux server restart.
set -g @resurrect-hook-post-save-layout '$HOME/.tmux/scripts/resurrect-strip-zoomfloat'
bind-key r run-shell "tmux source-file $HOME/.tmux.conf > /dev/null; tmux display-message 'Sourced tmux config!'"
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @override_copy_command 'tmux load-buffer -w -'
set -g @plugin 'fcsonline/tmux-thumbs'
set -g @thumbs-hint-fg-color red
# tmux-thumbs' own --osc52 flag writes raw escape bytes from inside a
# backgrounded run-shell job, which never reaches a real client tty (it just
# gets captured as job output). Use tmux's own native `set-buffer -w`
# instead, which calls tty_set_selection() directly on the attached client.
set -g @thumbs-command 'tmux set-buffer -w -- "{}" && tmux display-message "Copied {}"'
set -g @thumbs-upcase-command 'tmux set-buffer -w -- "{}" && tmux paste-buffer && tmux display-message "Copied {}"'
set -g @thumbs-multi-command 'tmux set-buffer -w -- "{}" && tmux paste-buffer && tmux send-keys '"'"' '"'"' && tmux display-message "Copied multiple items!"'
# set -g @plugin 'ofirgall/tmux-window-name'
# set -g @tmux_window_name_icon_style "'name_and_icon'"
set -g @plugin 'alberti42/tmux-fzf-links'
set-option -g @fzf-links-fzf-display-options "-w 80% --maxnum-displayed 20 --multi --track"
if-shell 'OSTYPE=$(uname -s) && case $OSTYPE in "Linux") true; ;; *) false; ;; esac' {
# Linux
set-option -g @fzf-links-browser-open-cmd "xdg-open '%url'"
}{
if-shell 'OSTYPE=$(uname -s) && case $OSTYPE in "Darwin") true; ;; *) false; ;; esac' {
# Darwin
set-option -g @fzf-links-browser-open-cmd "open '%url'"
}
}
set -g @plugin 'sainnhe/tmux-fzf'
TMUX_FZF_OPTIONS="-p -w 80% -h 50% "
bind "C-s" run-shell "$HOME/.tmux/plugins/tmux-fzf/scripts/session.sh switch"
bind -n "M-s" run-shell "$HOME/.tmux/plugins/tmux-fzf/scripts/session.sh switch"
bind "C-w" run-shell "$HOME/.tmux/plugins/tmux-fzf/scripts/window.sh switch"
bind -n "M-w" run-shell "$HOME/.tmux/plugins/tmux-fzf/scripts/window.sh switch"
bind "C-p" run-shell "$HOME/.tmux/plugins/tmux-fzf/scripts/pane.sh switch"
bind -n "M-p" run-shell "$HOME/.tmux/plugins/tmux-fzf/scripts/pane.sh switch"
bind "w" choose-tree -Z
bind "c-n" command-prompt -I "new -s "
bind "z" run-shell "$HOME/.tmux/scripts/pane-float-zoom '#{pane_id}' '#{client_name}' '#{session_name}'"
# Escape hatch: unconditionally kill the zoomfloat session if a zoom ever
# gets wedged. Loses whatever pane was mid-float, but always gets you unstuck.
bind "Z" run-shell "tmux kill-session -t zoomfloat 2>/dev/null; tmux display-message 'zoom session reset'"
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-0 select-window -t 0
bind 1 select-window -t 1
bind 2 select-window -t 2
bind 3 select-window -t 3
bind 4 select-window -t 4
bind 5 select-window -t 5
bind 6 select-window -t 6
bind 7 select-window -t 7
bind 8 select-window -t 8
bind 9 select-window -t 9
bind 0 select-window -t 0
# HU layout symbols mode (kanata vk_num off): unshifted number row outputs HU symbols
bind "'" select-window -t 1
bind '"' select-window -t 2
bind + select-window -t 3
bind ! select-window -t 4
bind % select-window -t 5
bind / select-window -t 6
bind = select-window -t 7
bind ( select-window -t 8
bind ) select-window -t 9
bind § select-window -t 0
# Track last pane across sessions
set-hook -g pane-focus-out 'run "tmux set -g @last_pane_id #{pane_id}"'
bind "," run-shell 'tmux switch-client -t$(tmux show -gqv @last_pane_id)'
# Alt-, : jump to the last session (project). switch-client -l is the built-in
# "previous session", unlike the pane-id hack on the prefix binding above.
bind -n M-, switch-client -l
# Alternative: switch to the last-used window in the current session instead
# of the last session.
# bind -n M-, last-window
# opencode TUI pane (parked in window 99). M-o toggles it beside the current
# pane, M-b toggles it below. See ~/.tmux/scripts/opencode-pane.
# (M-ö/M-ü can't be used: kanata's HU layer turns Alt+ö/ü into < / >.)
# bind -n M-o run-shell "$HOME/.tmux/scripts/opencode-pane toggle"
bind -n M-b run-shell "$HOME/.tmux/scripts/opencode-pane toggle -v"
bind -n M-h resize-pane -L 5
bind -n M-j resize-pane -D 5
bind -n M-k resize-pane -U 5
bind -n M-l resize-pane -R 5
bind -n M-t run-shell 'tmuxscratch'
bind t run-shell 'tmuxscratch'
set -g @plugin 'jaclu/tmux-power-zoom'
set -g @power_zoom_without_prefix '1'
set -g @power_zoom_trigger 'M-z'
# set -g @plugin 'graemedavidson/tmux-pane-focus'
# set -g @pane-focus-size on
# set -g @pane-focus-size '50'
# set -g @pane-focus-direction '+'
set -g focus-events on
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
run '~/.tmux/plugins/tpm/tpm'
# tmux-thumbs: trigger without the prefix (M-f, mnemonic "fingers")
unbind-key -T prefix Space
bind-key -n M-f run-shell -b "~/.tmux/plugins/tmux-thumbs/tmux-thumbs.sh"
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
bind-key -n 'C-é' if-shell "$is_vim" 'send-keys C-é' 'select-pane -l'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
bind-key -T copy-mode-vi 'C-é' select-pane -l