-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
175 lines (131 loc) Β· 6.18 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
# ------------------------------------------------------------------------------
# PLUGINS
# ------------------------------------------------------------------------------
set -g @plugin 'tmux-plugins/tpm' # plugin manager
set -g @plugin 'tmux-plugins/tmux-resurrect' # restore sessions after system restart
set -g @plugin 'tmux-plugins/tmux-continuum' # save sessions every 15 minutes
set -g @plugin 'christoomey/vim-tmux-navigator' # better pane navigation
set -g @plugin 'tmux-plugins/tmux-yank' # Clipboard support
set -g @plugin 'tmux-plugins/tmux-sensible' # Basic tmux settings
set -g @plugin 'dreamsofcode-io/catppuccin-tmux'
set -g @plugin 'omerxx/tmux-sessionx'
set -g @plugin 'omerxx/tmux-floax'
set -g @plugin 'fcsonline/tmux-thumbs'
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'wfxr/tmux-fzf-url'
# init tmux plugin manager (keep this line at the bottom of plugins)
run '~/.tmux/plugins/tpm/tpm'
# See: https://github.com/tmux-plugins/tmux-continuum/blob/master/docs/automatic_start.md#os-x
set -g @continuum-restore 'on' # restore last autosaved tmux session
set -g @continuum-save-interval '5' # save sessions more often
set -g detach-on-destroy on # don't exit from tmux when closing a session
set -g escape-time 0 # zero-out escape time delay
set -g @resurrect-capture-pane-contents 'off' # don't restore pane contents (it's noisy and glitchy)
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-strategy-vim 'session'
# ------------------------------------------------------------------------------
# SETTINGS
# ------------------------------------------------------------------------------
set -g @catppuccin_flavour 'mocha'
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# set the default shell
set -g default-shell ${SHELL}
set -g default-command ${SHELL}
# enable mouse mode and better scroll behavior
set -g mouse on
set -g @scroll-speed-num-lines-per-scroll 1
set -g @scroll-without-changing-pane on
# Allow tmux to set the terminal title and set title string
set -g set-titles on
set -g set-titles-string '#h β #S β #I #W'
# color improvements (use 256 color)
set-option -ga terminal-overrides ",xterm-256color:Tc"
set-option -g default-terminal "screen-256color"
# fix insert mode exit lag in vim
set -sg escape-time 0
# use vim keybindings
setw -g mode-keys vi
# setup vim-like copy mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
bind P paste-buffer
# Renumber windows when a window is closed.
set -g renumber-windows on
# don't rename windows automatically after each executed command
set -g allow-rename off
# notified about activity in other tmux windows
set -g display-time 2500 # display messages for 3 seconds
set -wg monitor-activity on
set -wg monitor-bell on
set -g focus-events on
# required for yazi's image preview and better terminal support
# see: https://yazi-rs.github.io/docs/image-preview#tmux
set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
set -ga terminal-features ',*:clipboard'
set -ga terminal-features ',*:RGB'
# increase scrollback buffer and add better session handling
set-option -g history-limit 50000
set -g @continuum-restore 'on'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-dir '~/.tmux/resurrect'
set -g @fzf-url-fzf-options '-p 60%,30% --prompt="ο " --border-label=" Open URL "'
set -g @fzf-url-history-limit '2000'
# open panes and splits in the same working directory
bind c new-window -c "#{pane_current_path}"
# bind < and > to swap windows
bind-key -r < swap-window -t -1
bind-key -r > swap-window -t +1
# split panes with | and -
bind i split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# popup
# bind P display-popup -E 'cd $(tmux display -p -F "#{pane_current_path}") && tmux new-session -A -s scratch'
bind K display-popup -E -w 40% "sesh connect \"$(
sesh list -i | gum filter --limit 1 --placeholder 'Pick a sesh' --height 50 --prompt='β‘'
)\""
# open lazygit in the cwd with g
bind g run 'tmux popup -EE -h 100% -w 100% "lazygit -p "#{pane_current_path}""'
# open lazydocker in the cwd with g
bind d run 'tmux popup -EE -h 100% -w 100% lazydocker'
# pane resizing
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
# enable focus events, needed for when vim is running inside tmux
set -g focus-events on
# status bar design
set-option -g status-style fg=default
set-option -g status-style bg=default
set -g status-position bottom
setw -g window-status-current-style fg=cyan,bold
setw -g window-status-style fg=default,bg=default
bind-key "T" run-shell "sesh connect \"$(
sesh list | fzf-tmux -p 55%,60% \
--no-sort --ansi --border-label ' sesh ' --prompt 'β‘ ' \
--header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^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-g:change-prompt(βοΈ )+reload(sesh list -c)' \
--bind 'ctrl-x:change-prompt(π )+reload(sesh list -z)' \
--bind 'ctrl-f:change-prompt(π )+reload(fd -H -d 2 -t d -E .Trash . ~)' \
--bind 'ctrl-d:execute(tmux kill-session -t {})+change-prompt(β‘ )+reload(sesh list)'
)\""
bind-key x kill-pane # skip "kill-pane 1? (y/n)" prompt
# Synchronize panes
bind-key C-s set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
# Smart pane switching with awareness of Vim splits
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?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'
# Quick reload config
bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded"