-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
222 lines (168 loc) · 7.98 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
#--------------------------------------------------------------------------
# Configuration
#--------------------------------------------------------------------------
# Use Vi mode
setw -g mode-keys vi
# Increase scrollback buffer size
set -g history-limit 40000
# 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
# set -g automatic-rename off
# Renumber windows when one is removed.
set -g renumber-windows on
# Improve colors
set -g default-terminal "${TERM}"
# 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 the mouse to resize windows and select tabs
set -g mouse on
# Allow tmux to set the terminal title
set -g set-titles on
# Monitor window activity to display in the status bar
setw -g monitor-activity 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
# Focus events enabled for terminals that support them
set -g focus-events on
# Useful when using sharing a session with different size terminals
setw -g aggressive-resize on
# don't detach tmux when killing a session
set -g detach-on-destroy off
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
set -as terminal-features ",*:RGB"
# set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
#--------------------------------------------------------------------------
# Status line
#--------------------------------------------------------------------------
set-option -g status-left-length 100
set-option -g status-right-length 100
# set-option -g status-left " #{session_name} "
# set-option -g status-right " "
# set-option -g status-style "fg=#7C7D83 bg=#18242e" # ayu
# set-option -g status-style "fg=#7C7D83 bg=#16151d" # tokyo night
# set-option -g status-style "fg=#7C7D83 bg=#24282f" # one dark
# set-option -g status-style "fg=#7C7D83 bg=default" # gruvbox dark
# set-option -g status-style "fg=#828bb1 bg=default" # default will set the background to transparent
set-option -g window-status-format "#{window_index}:#{window_name} " # window_name -> pane_current_command
set-option -g window-status-current-format "#{window_index}:#{window_name}"
# set-option -g window-status-current-style "fg=#aeb6ff" #for gruvbox use: dcc7a0 or aeb6ff
set-option -g window-status-activity-style none
#--------------------------------------------------------------------------
# Key Bindings
#--------------------------------------------------------------------------
# -r means that the bind can repeat without entering prefix again
# -n means that the bind doesn't use the prefix
set -g prefix C-a
# Send prefix to a nested tmux session by doubling the prefix
bind C-a send-prefix
# 'PREFIX r' to reload of the config file
unbind r
bind r source-file ~/.tmux.conf\; display-message '~/.tmux.conf reloaded'
# Allow holding Ctrl when using using prefix+p/n for switching windows
bind C-p previous-window
bind C-n next-window
# 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
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 n next-window
bind -r p previous-window
# Stop tmux from switching panes without the header key being pressed
# (Tmux waits for a short time after a keypress to see if any additional
# keypresses are being combo-ed.)
# set repeat-time 0
# resize panes more easily
bind H resize-pane -L 5
bind L resize-pane -R 5
bind J resize-pane -D 5
bind K resize-pane -U 5
# resize panes more easily with Ctrl
bind -r C-H resize-pane -L 7
# bind -r C-L resize-pane -R 5
bind -r C-J resize-pane -D 5
bind -r C-K resize-pane -U 5
# 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
# break pane out of window
bind-key B break-pane -d
# put pane back into window
bind-key E command-prompt -p "join pane from: " "join-pane -h -s '%%'"
# allow to copy to system clipboard
bind-key y run -b "tmux show-buffer | xclip -selection clipboard"\; display-message "copied tmux buffer to system clipboard"
# open lazygit in a new window with prefix+g
bind-key g new-window -n lazygit -c "#{pane_current_path}" "lazygit"
# open an application in a new window with prefix+o, and allow me to provide the app name
bind-key o command-prompt -p "open app: " "new-window '%%'"
# show a promp to kill a window by id with prefix+X
bind-key X command-prompt -p "kill window: " "kill-window -t '%%'"
# 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 v split-window -h -c "#{pane_current_path}"
bind s split-window -v -c "#{pane_current_path}"
# change the path for newly created windows
bind c new-window -c "#{pane_current_path}"
bind C-e display-popup -E "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
sed '/^$/d' |\
fzf --reverse --header jump-to-session |\
xargs tmux switch-client -t"
# The Ctrl + L to clear screen in zsh should take precedence
bind -n C-l send-keys 'C-l'
# Move tmux status bar to top
# bind-key C-k run-shell "tmux set-option -g status-position top;"
# Move tmux status bar to bottom
# bind-key C-j run-shell "tmux set-option -g status-position bottom;"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set-option -s status-interval 1
# set -g @plugin 'joshmedeski/tmux-nerd-font-window-name'
# Status line customisation
set -g @plugin 'catppuccin/tmux#v1.0.3'
set -g @catppuccin_flavor "macchiato"
set -g @catppuccin_window_status_style "rounded"
set -g @catppuccin_window_current_background "#{@thm_lavender}"
set -g @catppuccin_pane_status_enabled "yes"
set -g @catppuccin_pane_border_status "off" # See `pane-border-status`
set -g @catppuccin_pane_left_separator "█"
set -g @catppuccin_pane_right_separator "█"
set -g @catppuccin_pane_middle_separator "█"
set -g @catppuccin_pane_number_position "left"
set -g @catppuccin_pane_default_fill "number"
set -g @catppuccin_pane_default_text "#W" # "#{b:pane_current_path}"
set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_pane_border_style "fg=#{@thm_overlay_0}"
set -g @catppuccin_pane_active_border_style "#{?pane_in_mode,fg=#{@thm_lavender},#{?pane_synchronized,fg=#{@thm_magenta},fg=#{@thm_lavender}}}"
set -g @catppuccin_pane_color "#{@thm_green}"
set -g @catppuccin_pane_background_color "#{@thm_surface_0}"
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'anghootys/tmux-ip-address'
set -g @plugin 'swaroopch/tmux-pomodoro'
set -g status-left '#[fg=green]#H #[fg=black]• #[fg=green,bright]#(uname -r | cut -c 1-6) #[default]'
set -g status-right 'ipv4:#[fg=#81ffa1,bg=default]#{ip_address} #[fg=#81a1a1,bg=default]#{ram_icon}RAM #{ram_fg_color}#{ram_percentage} #{cpu_fg_color}#{cpu_icon}CPU #{cpu_percentage} #{cpu_temp_fg_color}cpu_temp: #{cpu_temp_icon}#{cpu_temp} #[fg=white,bg=default] #[default]'
run '~/.tmux/plugins/tpm/tpm'