-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_tmux.conf
More file actions
212 lines (164 loc) · 6.66 KB
/
dot_tmux.conf
File metadata and controls
212 lines (164 loc) · 6.66 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
setw -g mode-keys vi
set -g status-keys vi
set-option -g default-shell /opt/homebrew/bin/zsh
set -g default-terminal 'tmux-256color'
set -g base-index 1
setw -g pane-base-index 1
set -g pane-border-format " #{pane_current_path}: #{pane_current_command} "
# make it easy to distinguish between active and inactive windows
set -g pane-border-lines heavy
set -g pane-border-indicators both
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 '▒'
# 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
# mimic vim last buffer for last session
bind-key ^ switch-client -l
# 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 30
# focus events enabled for terminals that support them
set -g focus-events on
# useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# switching between next/prev window
bind-key C-p previous-window
bind-key C-n next-window
# alt # to quick navigate windows
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
# reload tmux config
bind-key R run-shell -b ' \
tmux source-file ~/.tmux.conf > /dev/null; \
tmux display-message "Sourced .tmux.conf!"'
# 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 500000
# Sync panes - send what you're typing to other panes.
bind-key Space 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 20
bind-key -r J resize-pane -D 20
bind-key -r K resize-pane -U 20
bind-key -r L resize-pane -R 20
# theme
source-file ~/.tmux/themes/tmux_tokyonight_dark.tmux
# https://github.com/christoomey/vim-tmux-navigator
# Smart pane switching with awareness of (N)Vim and Fzf
not_tmux='#{m/r:^(n?vim|fzf)$,#{pane_current_command}}'
bind-key -n 'C-h' if-shell -F "$not_tmux" 'send-keys' 'select-pane -L'
bind-key -n 'C-j' if-shell -F "$not_tmux" 'send-keys' 'select-pane -D'
bind-key -n 'C-k' if-shell -F "$not_tmux" 'send-keys' 'select-pane -U'
bind-key -n 'C-l' if-shell -F "$not_tmux" 'send-keys' 'select-pane -R'
# Switch panes while in copy mode
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"
# trigger reverse search, prefix + /
bind-key / copy-mode \; send-key ?
# enter copy mode, previx + v
bind-key v copy-mode
# 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"
### 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'):\""'
}
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
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 'laktak/extrakto'
set -g @extrakto_insert_key "enter"
set -g @extrakto_fzf_layout "reverse"
set -g @extrakto_clip_tool "echo -n {} | pbcopy"
set -g @extrakto_copy_key "tab" # use tab to copy to clipboard
set -g @extrakto_split_direction "p"
set -g @extrakto_filter_key "ctrl-f" # Key to toggle filter mode.
set -g @extrakto_grab_key "ctrl-g" # Key to toggle grab mode.
set -g @extrakto_edit_key "ctrl-e" # Key to run the editor.
set -g @extrakto_open_key "ctrl-o" # Key to run the open command.
# prefix + tab - autocomplete
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# prefix + Ctrl-s - save
# prefix + Ctrl-r - restore
set -g @resurrect-processes 'false' # don't restore any programs
set -g @resurrect-dir '~/.tmux/resurrect'
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 'fcsonline/tmux-thumbs'
set -g @thumbs-key F
set -g @thumbs-reverse enabled
set -g @thumbs-command 'echo -n {} | pbcopy'
# keep as last plugin *****************************************
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
# keep as last plugin *****************************************
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# override theme right status
set -g status-right ''
# clear screen, <prefix> C-l
bind C-l send-keys 'C-l'