-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
77 lines (67 loc) · 3.25 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
# color & font adjustments
set -g default-terminal "Tmux-256color"
set -ga terminal-overrides ",xterm-256color*:Tc"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
set -ga update-environment 'KITTY_LISTEN_ON'
# options
set -s escape-time 0 # disable pane switching with escape
set -g mouse on
set -g history-limit 100000
set -g base-index 1
set-window-option -g pane-base-index 1
set-window-option -g mode-keys vi
bind-key C-b set -g status
#### Pane Switching ####
# 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|l?n?vim?x?)(diff)?$'"
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
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 'M-\\' if-shell \"$is_vim\" 'send-keys M-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys M-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'M-h' select-pane -L
bind-key -T copy-mode-vi 'M-j' select-pane -D
bind-key -T copy-mode-vi 'M-k' select-pane -U
bind-key -T copy-mode-vi 'M-l' select-pane -R
bind-key -T copy-mode-vi 'M-\' select-pane -l
#### Resize Panes ####
bind -n M-Left resize-pane -L 5
bind -n M-Right resize-pane -R 5
bind -n M-Up resize-pane -D 5
bind -n M-Down resize-pane -U 5
### Plugins ###
# Tmux Plugin Manager (TPM): `git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm`
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect' # save and restore tmux environment
set -g @plugin 'tmux-plugins/tmux-continuum' # automatic tmux environment saving every 15 min.
set -g @plugin 'alexwforsythe/tmux-which-key'
set -g @plugin 'catppuccin/tmux'
# Theme
set -g @catppuccin_flavour 'mocha' # or frappe, macchiato, latte
set -g @catppuccin_window_status_style 'rounded' # or frappe, macchiato, latte
set -g @catppuccin_window_tabs_enabled on # or off to disable window_tabs
set -g status-right-length 100
set -g status-left-length 100
set -g status-left ""
set -g status-right "#{E:@catppuccin_status_application}"
set -ag status-right "#{E:@catppuccin_status_session}"
# tmux-resurrect and tmux-continuum settings
set -g @resurrect-dir '~/.tmux/resurrect'
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @continuum-restore 'on'
## Set keybinding to clean resurect-dir
bind-key C-c run-shell "rm -r ~/.tmux/resurrect/*; tmux display 'Resurrect dir cleaned!'"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'