/
.tmux.conf
195 lines (152 loc) · 5.97 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
### SETTINGS ###
#
# Fix terminal colors
set -ag terminal-overrides ",alacritty:RGB,xterm-256color:RGB"
# Enable CSI u
set -g extended-keys on
set -sag terminal-features 'xterm*:extkeys'
# Set default shell
set-option -g default-shell /usr/bin/fish
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
# Increase repeat time
set -g repeat-time 1000
# Start window and pane numbering from 1 for easier switching
set -g base-index 1
setw -g pane-base-index 1
# Allow automatic renaming of windows
set -g allow-rename on
# Renumber windows when one is removed.
set -g renumber-windows on
# Enable vi keybindings in copy mode
setw -g mode-keys vi
# Enable undercurl
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
# Enable undercurl colors
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
# Allow tmux to set the terminal title
set -g set-titles on
# A bell in another window should cause a bell in the current window
set -g bell-action any
# Don't show distracting notifications
set -g visual-bell off
set -g visual-activity off
# Don't detach tmux when killing a session
set -g detach-on-destroy off
### KEYBINDINGS ###
#
# Change prefix key
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Copy mode
bind -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send -X copy-selection-and-cancel
bind P paste-buffer
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel
# Switch windows without prefix (Alt+Ctrl+left/right arrow keys)
bind -n M-C-Right next-window
bind -n M-C-Left previous-window
# Resize pane without prefix (Alt+Shift+arrow keys)
bind -n M-S-Left resize-pane -L 1
bind -n M-S-Down resize-pane -D 1
bind -n M-S-Up resize-pane -U 1
bind -n M-S-Right resize-pane -R 1
# Split pane
unbind s
bind s split-window -v
bind v split-window -h
# Choose session from list
bind S choose-session -Z
bind Tab choose-session -Z
# Kill pane without confirmation
bind x killp
# Display pane numbers
# bind C-q display-panes
# Move around panes like in vim
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
# Switch windows
# bind -r C-h select-window -t :-
# bind -r C-l select-window -t :+
# Smart pane switching with awareness of vim splits
# is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
# bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
# bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
# bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
# bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
# Switch between previous and next windows with repeatable
bind -r C-n next-window
bind -r C-p previous-window
# Move the current window to the next window or previous window position
bind -r N run-shell "tmux swap-window -t $(expr $(tmux list-windows | grep \"(active)\" | cut -d \":\" -f 1) + 1)"
bind -r P run-shell "tmux swap-window -t $(expr $(tmux list-windows | grep \"(active)\" | cut -d \":\" -f 1) - 1)"
# Switch between two most recently used windows
bind Space last-window
# Switch between two most recently used sessions
bind b switch-client -l
# Use prefix+| (or prefix+\) to split window horizontally and prefix+- or
# (prefix+_) to split vertically also use the current pane path to define the
# new pane path
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Change the path for newly created windows
bind c new-window -c "#{pane_current_path}"
# Window with a list of sessions to switch to
bind y run -b "tmux show-buffer | xclip -selection clipboard"\; display-message "copied tmux buffer to system clipboard"
# Kill current session
bind K kill-session
# Run tmux-sessionizer script
unbind t
bind t run-shell tmux-sessionizer
bind T clock-mode # rebind clock command from 't' to 'T'
### PLUGINS ###
#
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin "tmux-plugins/tmux-prefix-highlight"
set -g @plugin 'catppuccin/tmux'
# set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @plugin 'tmux-plugins/tmux-sessionist'
# set -g @plugin "arcticicestudio/nord-tmux"
# Resurrect settings
set -g @resurrect-capture-pane-contents 'on'
# Continuum settings
# set -g @continuum-restore 'on'
# Sessionist keybindings
# set -g @sessionist-join-pane "T"
# set -g @nord_tmux_no_patched_font "1"
# Nord theme settings
# set -g @nord_tmux_show_status_content "0" # disable default status
# Catppuccin theme settings
set -g @catppuccin_flavour "mocha"
set -g @catppuccin_status_modules_right "directory session date_time"
set -g @catppuccin_session_text "#(tmux ls | wc -l && tmux refresh-client -S)"
set -g @catppuccin_window_right_separator "█ "
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_middle_separator " | "
set -g @catppuccin_window_default_fill "none"
set -g @catppuccin_window_current_fill "all"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_status_left_separator "█"
set -g @catppuccin_status_right_separator "█"
set -g @catppuccin_date_time_text "%A ~ %I:%M %p"
### STATUS ###
#
# Bars
# set -g status-left "#[fg=black,bg=blue,bold] #(tmux ls | wc -l && tmux refresh-client -S) "
# set -g status-right "#{prefix_highlight}#[fg=white,bg=brightblack] %H:%I %p#[fg=cyan,bg=brightblack,nobold,noitalics,nounderscore] #[fg=black,bg=cyan,bold] #{b:pane_current_path} "
# Windows
# set -g window-status-format " #[fg=white,bg=brightblack] #I #[fg=white,bg=brightblack]#W #F "
# set -g window-status-current-format " #[fg=black,bg=cyan] #I#[fg=black,bg=cyan,nobold,noitalics,nounderscore] #[fg=black,bg=cyan]#W #F "
# set -g window-status-separator ""
### PLUGIN MANAGER ###
#
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run "~/.tmux/plugins/tpm/tpm"