-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
303 lines (248 loc) · 9.06 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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# ---------------
# Prefix: Ctrl+s
#
# Install all tmp plugins: Ctrl+s I
#
# ---------------
# -----------------------------------------------------------------------------
# Plugin Manager - https://github.com/tmux-plugins/tpm
# If you didn't use my dotfiles install script you'll need to:
# Step 1) git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# Step 2) Reload tmux if it's already started with `r
# Step 3) Launch tmux and hit `I (capital i) to fetch any plugins
# -----------------------------------------------------------------------------
# Conternts:
# -
# -
# -
# -
# -
# -
# -
# -
#
# See later:
# -- https://www.youtube.com/watch?v=bdumjiHabhQ
# -- FZF & open file quickly & move to any dir quickly
# - https://stackoverflow.com/questions/tagged/tmux#_=_
# - tmate: https://github.com/tmate-io/tmate
# -- https://github.com/preservim/vimux
# - https://github.com/tmux-plugins/tmux-resurrect
# - https://github.com/tmuxinator/tmuxinator
# - https://github.com/search?q=tmux
# - https://github.com/junegunn/fzf#fuzzy-completion-for-bash-and-zsh
# - https://www.youtube.com/watch?v=hJzqEAf2U4I
# - http://www.deanbodenham.com/learn/tmux-conf-file.html
# -- read vimux docs
# - how to re-order panes & windows quickly
# - https://gist.github.com/mislav/5189704
# - https://www.bugsnag.com/blog/tmux-and-vim
# - https://jay-baker.com/posts/
# - https://www.rockyourcode.com/copy-and-paste-in-tmux/
# -----------------------------------------------------------------------------
#General settings:
# -----------------------------------------------------------------------------
# setup the leader key
unbind C-b
set -g prefix C-s
bind-key C-s send-prefix
#set mouse off/on - if off, forces you to use keyboard with prefix-[
set -g mouse on
#256 colours
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",xterm-256color*:Tc"
# start with window 1 (instead of 0)
set -g base-index 1
# Start windows and panes index at 1, not 0.
set -g base-index 1
setw -g pane-base-index 1
# use vi mode
setw -g mode-keys vi
set -g status-keys vi
# more settings to make copy-mode more vim-like
unbind [
unbind p
bind p paste-buffer
bind -T copy-mode-vi v send -X begin-selection
# Remove delay when switching between Vim modes.
set -sg escape-time 0
# Add a bit more scroll history in the buffer.
set -g history-limit 50000
# Allow opening multiple terminals to view the same session at different sizes.
#setw -g aggressive-resize on
# perfix y synchronize all panes in a window
bind y setw synchronize-panes
# Allow Vim's FocusGained to work when your terminal gains focus.
# Requires Vim plugin: https://github.com/tmux-plugins/vim-tmux-focus-events
#set -g focus-events on
# tile all windows #FIXME ??
unbind =
bind = select-layout tiled
# Default name for new windows
set-option -g set-titles on
set-option -g set-titles-string "#T - #W"
set-window-option -g automatic-rename on
set-option -g automatic-rename-format "🍅"
# IMPORTAND!
set -g @resurrect-save-shell-history 'off'
#
set -g status-interval 1
# prefix [ - enter copy mode
bind-key [ copy-mode
# cancel
bind Escape run 'true'
# -----------------------------------------------------------------------------
# NAVIGATION
# -----------------------------------------------------------------------------
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# vim-like pane resizing
# don't resize , just zooom
#bind -r C-k resize-pane -U +20
#bind -r C-j resize-pane -D +20
#bind -r C-h resize-pane -L +20
#bind -r C-l resize-pane -R +20
# vim-like pane switching
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
# C-u clear screen, without perfix
bind C-l send-keys 'C-l'
# and now unbind keys
unbind Up
unbind Down
unbind Left
unbind Right
unbind C-Up
unbind C-Down
unbind C-Left
unbind C-Right
# splitting panes
bind | split-window -h -c '#{pane_current_path}'
bind _ split-window -v -c '#{pane_current_path}'
# Ctrl-Space to zoom current pane
bind-key -n C-Space resize-pane -Z
# jump to the last window
bind-key -n C-g last-window
bind-key p previous-window
# swap windows left & right
# swap windows left & right - https://superuser.com/a/552493
bind-key -n C-Pageup swap-window -t -1\; select-window -t -1
bind-key -n C-Pagedown swap-window -t +1\; select-window -t +1
# -----------------------------------------------------------------------------
# misc
# -----------------------------------------------------------------------------
# reload tmux config file
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
# FIXME ???
if-shell '[[ $(uname -s) = Linux ]]' {
bind -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -i -sel clipboard'; \
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"; \
bind C-v run 'tmux set-buffer "$(xclip -o -sel clipboard)"; tmux paste-buffer'
}
# open new panes in current path
bind C-c new-window -c '#{pane_current_path}'
# -----------------------------------------------------------------------------
# Theme
# -----------------------------------------------------------------------------
# NOTE: you can use vars with $<var> and ${<var>} as long as the str is double quoted: ""
# WARNING: hex colors can't contain capital letters
thm_bg="#1e1e28"
thm_fg="#d7dae0"
thm_cyan="#c2e7f0"
thm_black="#15121c"
thm_gray="#2d293b"
thm_magenta="#c6aae8"
thm_pink="#770020"
thm_red="#e28c8c"
thm_green="#b3e1a3"
thm_yellow="#eadda0"
thm_blue="#8ec2ff"
thm_orange="#f5c196"
catppuccin12="#3e4058"
# status
set -g status-position bottom
set -g status "on"
set -g status-bg "${thm_bg}"
set -g status-justify "left"
set -g status-left-length "100"
set -g status-right-length "100"
# messages
set -g message-style fg="${thm_cyan}",bg="${thm_gray}",align="centre"
set -g message-command-style fg="${thm_cyan}",bg="${thm_gray}",align="centre"
# panes
# set -g pane-border-style fg="${thm_gray}"
# set -g pane-active-border-style fg="${thm_blue}"
set-window-option -g pane-active-border-style fg=$thm_blue
set-window-option -g pane-border-style fg=$catppuccin12
# windows
setw -g window-status-activity-style fg="${thm_fg}",bg="${thm_bg}",none
setw -g window-status-separator ""
setw -g window-status-style fg="${thm_fg}",bg="${thm_bg}",none
tm_tunes="#(osascript -l JavaScript $DOTFILES/applescripts/tunes.js)"
tm_tunes_display="#[bg=${thm_bg}]#[fg=$thm_pink]#[bg=$thm_pink]#[fg=$thm_bg] #[bg=$thm_gray]#[fg=$thm_fg] ${tm_tunes}"
# Statusline
set -g status-left ""
set -g status-right ""
# status pwd - https://unix.stackexchange.com/a/525358/265591
set -g window-status-current-format ""
set -g window-status-format "#[fg=black] #(~/dotfiles/scripts/tmux_pwd.sh #{pane_current_path})"
# current_dir
setw -g window-status-format " #[fg=$thm_bg,bg=$thm_blue] #I #[fg=$thm_fg,bg=$thm_gray] #{?#{window_name},#W,#{b:pane_current_path}} "
setw -g window-status-current-format \
" #[fg=white,bg=$thm_pink]#{?window_zoomed_flag, 🔍 , }\
#I #{?#{window_name},#W,#{b:pane_current_path}} \
#[fg=black,bg=white]📌 #(~/dotfiles/scripts/tmux_pwd.sh #{pane_current_path}) "
# Modes
setw -g clock-mode-colour "${thm_blue}"
setw -g mode-style "fg=${thm_pink} bg=${catppuccin12} bold"
set -g status off
# -----------------------------------------------------------------------------
# tmux plugin manager
# -----------------------------------------------------------------------------
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'pschmitt/tmux-ssh-split'
# Plugins config:
set -g @continuum-restore 'on'
set -g @continuum-save-interval '10'
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
#set -g @resurrect-save-shell-history 'on'
set -g @open-S 'https://www.google.com/search?q='
# pschmitt/tmux-ssh-split
set-option -g @ssh-split-keep-cwd "true"
set-option -g @ssh-split-fail "false"
set-option -g @ssh-split-no-shell "false"
set-option -g @ssh-split-strip-cmd "true"
set-option -g @ssh-split-verbose "true"
set-option -g @ssh-split-h-key "|"
set-option -g @ssh-split-v-key "_"
set -g @plugin 'pschmitt/tmux-ssh-split'
# -----------------------------------------------------------------------------
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
# -----------------------------------------------------------------------------
run '~/.tmux/plugins/tpm/tpm'
#
#
#
#
#
# prefix esc ; enter scroll mode
# C-\ ; jump to the last active pane
# ctrl+a ; increase the number under the curser by one
# prefix + shift-l ; toggle between two active tmux sessions
##### copycat
# prefix + ctrl-f - file
# prefix + ctrl-u - urls
# prefix + ctrl-g - git status files
# prefix + ctrl-d - number search (mnemonic d, as digit)
# enter - copy a highlighted match
# perfix + ] - paste