This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
242 lines (192 loc) · 8.79 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
setw -g mode-keys vi
set -g status-keys vi
# https://github.com/folke/tokyonight.nvim#making-undercurls-work-properly-in-tmux
# ignores this advice https://github.com/neovim/neovim/wiki/FAQ#home-or-some-other-special-key-doesnt-work
# something similar: https://www.reddit.com/r/tmux/comments/pt5sxb/comment/hduq6ft/?utm_source=share&utm_medium=web2x&context=3
set -g default-terminal "${TERM}"
# undercurl support
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
# support colors for undercurl
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
# https://github.com/folke/zen-mode.nvim/issues/18#issuecomment-867067637
set -ga update-environment 'KITTY_LISTEN_ON'
set -g base-index 1
setw -g pane-base-index 1
set -g pane-border-format " #{pane_current_path}: #{pane_current_command} "
set -g set-titles on
set -g set-titles-string "#S"
unbind-key C-b
set -g prefix C-a
# configure padding layout of unused area
set -g fill-character '▒'
# set-option -g set-clipboard on
# Ctrl-a + a` switches between alternate windows.
bind-key a last-window
# `c-a c-a` send `c-a` to the terminal
bind-key C-a send-prefix
# Ctrl+double tap a to increment numbers in Vim
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
# tmux messages are displayed for 4 seconds
set -g display-time 4000
# refresh 'status-left' and 'status-right' more often, 15 default
set -g status-interval 15
# focus events enabled for terminals that support them
set -g focus-events on
# super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# easier and faster switching between next/prev window
bind-key C-p previous-window
bind-key C-n next-window
# reload tmux config
bind-key R run-shell -b ' \
tmux source-file ~/.tmux.conf > /dev/null; \
tmux display-message "Sourced .tmux.conf!"'
# show reloaded in a popup
# bind r source-file ~/.tmux.conf \; display-popup -h 20 -w 80 -E 'figlet -f ~/.local/share/fonts/3d.flf -c "Tmux Reloaded !!!" | lolcat & sleep .4'
# togggle status bar
bind-key b set status
# togggle pane bar
bind-key B set pane-border-status
# scrollback buffer size increase
set -g history-limit 100000
# Sync panes - send what you're typing to other panes.
# bind-key s set-window-option synchronize-panes
# Use up and down arrows for temporary "maximize"
unbind-key Up; bind-key Up resize-pane -Z; unbind-key Down; bind-key Down resize-pane -Z
# resize panes
bind-key -r H resize-pane -L 10
bind-key -r J resize-pane -D 10
bind-key -r K resize-pane -U 10
bind-key -r L resize-pane -R 10
# theme
if-shell "test -f ~/.tmux/themes/tmux_tokyonight_dark.tmux" "source ~/.tmux/themes/tmux_tokyonight_dark.tmux"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'olimorris/tmux-pomodoro-plus'
set -g @pomodoro_mins 25 # The duration of the pomodoro
set -g @pomodoro_break_mins 5 # The duration of the break after the pomodoro
set -g @pomodoro_on " #[fg=$text_red]🍅 " # The formatted output when the pomodoro is running
set -g @pomodoro_complete " #[fg=$text_green]🍅 " # The formatted output when the break is running
set -g @pomodoro_notifications 'on' # Turn on desktop notifications
set -g @pomodoro_start 'p'
set -g @pomodoro_cancel 'P'
set -g @pomodoro_sound 'Pop'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @open-S 'https://www.duckduckgo.com/?q='
# o - "open" a highlighted selection with the system default program. open for OS X
# Ctrl-o - open a highlighted selection with the $EDITOR
# Shift-s - search the highlighted selection directly inside a search engine
set -g @plugin 'tmux-plugins/tmux-cowboy'
# prefix * to run kill -9 on current pane process
set -g @plugin 'knakayama/tmux-newline-detector'
set-option -g @peek 'u'
# remove newline on single line copy
set-option -g @paste ']'
set -g @plugin 'laktak/extrakto'
set -g @extrakto_insert_key "enter"
set -g @extrakto_fzf_layout "default"
set -g @extrakto_clip_tool "echo -n {} | pbcopy"
set -g @extrakto_copy_key "tab" # use tab to copy to clipboard
# prefix + tab - autocomplete
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'timtyrrell/tmux-spotify-controls'
set -g @plugin 'robhurring/tmux-spotify'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# prefix + Ctrl-s - save
# prefix + Ctrl-r - restore
# set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-processes 'false' # don't restore any programs
set -g @plugin 'roosta/tmux-fuzzback'
set -g @fuzzback-bind '?'
set -g @fuzzback-popup 1
set -g @fuzzback-popup-size '90%'
set -g @fuzzback-fzf-bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'abhinav/tmux-fastcopy'
set-option -g @fastcopy-key f
set-option -g @fastcopy-action pbcopy
set -g @plugin 'fcsonline/tmux-thumbs'
set -g @thumbs-key space
set -g @thumbs-command 'echo -n {} | pbcopy'
set -g @plugin 'chriszarate/tmux-docker'
set -g @plugin 'tardunge/kmux-status'
set-option -g @kmux-kcontext-icon "⎈"
set-option -g @kmux-kpod-exec-icon "E"
set-option -g @kmux-kpod-log-icon "L"
set-option -g @kmux-kpod-port-fw-icon "P"
# keep as last plugin *****************************************
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
set -g @continuum-boot-options 'kitty' # autoboot
# keep as last plugin *****************************************
# don't display status if only 1 window
if -F "#{==:#{session_windows},1}" "set -g status off" "set -g status on"
set-hook -g window-linked 'if -F "#{==:#{session_windows},1}" "set -g status off" "set -g status on"'
set-hook -g window-unlinked 'if -F "#{==:#{session_windows},1}" "set -g status off" "set -g status on"'
# Smart pane switching with awareness of Vim, Fzf, and Telescope
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
is_telescope="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?Telescope'"
bind-key -n C-h if-shell "$is_vim || $is_fzf || $is_telescope" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim || $is_fzf || $is_telescope" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim || $is_fzf || $is_telescope" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim || $is_fzf || $is_telescope" "send-keys C-l" "select-pane -R"
bind-key -n C-\\ if-shell "$is_vim || $is_fzf || $is_telescope" "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
# vi config
unbind-key -T copy-mode-vi v
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle \; send -X begin-selection "pbcopy"
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
# fuzzy select session
bind-key s display-popup -E "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
sed '/^$/d' |\
fzf --reverse --header jump-to-session |\
xargs tmux switch-client -t"
# try this one, also?
# bind s display-popup -E "\
# tmux list-windows -a -F '#{session_name}:#{window_index} - #{window_name}' \
# | grep -v \"^$(tmux display-message -p '#S')\$\" \
# | fzf --reverse \
# | sed -E 's/\s-.*$//' \
# | xargs tmux switch-client -t"
# project picker
bind C-g display-popup -E "~/bin/ta ~/code/invitae"
### floating windows
# if true, detach-client (you will be in floating window, so detach from that.. close popup and back to orig)
bind-key g if-shell -F '#{==:#S,dotfiles}' {
detach-client
} {
set -gF '@last_session_name' '#S'
popup -d '#{pane_current_path}' -xC -yC -w97% -h97% -E 'tmux new -A -s dotfiles \
"tmux set -w pane-border-status off; zsh"'
}
# if true, break-pane (break out the current pane into a new window)
bind-key ! if-shell -F '#{!=:#S,dotfiles}' {
break-pane
} {
set -uw pane-border-status
run-shell -b 'bash -c "tmux break-pane -s dotfiles -t \"$(tmux show -gvq '@last_session_name'):\""'
}
# if true, Same as ! mapping, just that focus does not shift to the broken pane after it moves to new window
bind-key @ if-shell -F '#{!=:#S,dotfiles}' {
break-pane -d
} {
set -uw pane-border-status
run-shell -b 'bash -c "tmux break-pane -d -s dotfiles -t \"$(tmux show -gvq '@last_session_name'):\""'
}
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# clear pane
# https://github.com/christoomey/vim-tmux-navigator/issues/9#issuecomment-261583970
# bind C-l send-keys C-l ; run 'sleep 0.1' ; clear-history