-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_tmux.conf
228 lines (180 loc) · 8.58 KB
/
dot_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
# Set tmux to use 256 colors and true color support
# set -g default-terminal "tmux-256color"
# set -ga terminal-overrides ",xterm-256color:Tc"
# "xterm-256color" in alacritty and "screen-256color" in tmux doesnt have paste issues in neovim
# "checkhealth" command in neovim shows no color warnings
# set -g default-terminal "screen-256color"
# "xterm-256color" in alacritty and "xterm-256color" in tmux gives me truecolor
# warnings in neovim
# set -g default-terminal "xterm-256color"
# When using "alacritty" in alacritty and "tmux-256color" in tmux, I was having paste
# issues when I pasted over text highlighted in visual mode, spaces were removed
# at the end of the text. This happened in NEOVIM specifically
# "checkhealth" command in neovim shows no color warnings
# set -g default-terminal "tmux-256color"
# I was getting this warning in neovim
# Neither Tc nor RGB capability set. True colors are disabled
# Confirm your $TERM value outside of tmux first, mine returned "screen-256color"
# echo $TERM
# set-option -sa terminal-features ',xterm-256color:RGB'
set -sg terminal-overrides ",*:RGB"
# Undercurl support (works with kitty)
# Fix found below in Folke's tokyonight theme :heart:
# https://github.com/folke/tokyonight.nvim#fix-undercurls-in-tmux
#
# After reloading the configuration, you also have to kill the tmux session for
# these changes to take effect
set -g default-terminal "${TERM}"
# undercurl support
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
# underscore colours - needs tmux-3.0
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
set -g status-style 'bg=default'
# Border lines between panes are thicker
# single -> single lines using ACS or UTF-8 characters
# double -> double lines using UTF-8 characters
# heavy -> heavy lines using UTF-8 characters
# simple -> simple ASCII characters
# number -> the pane number
set -g pane-border-lines single
# Indicate active pane by colouring only half of the border in windows with
# exactly two panes, by displaying arrow markers, by drawing both or neither.
# [off | colour | arrows | both]
set -g pane-border-indicators colour
# Increase scroll history
set-option -g history-limit 10000
set -gq allow-passthrough on # Enables passthrough mode in Tmux 3.3+ for rendering images via nvim - image.nvim
set -g visual-activity off # Automatically show/hide images when switching tabs (windows) per session
set-window-option -g xterm-keys on
set -g prefix C-a
unbind C-b
bind-key C-a send-prefix
unbind %
bind | split-window -h
unbind '"'
bind - split-window -v
unbind r
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
bind j resize-pane -D 5
bind k resize-pane -U 5
bind l resize-pane -R 5
bind h resize-pane -L 5
bind -r m resize-pane -Z
set -g mouse on
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection # start selecting text with "v"
bind-key -T copy-mode-vi 'y' send -X copy-selection # copy text with "y"
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
unbind -T copy-mode-vi MouseDragEnd1Pane # don't exit copy mode when dragging with mouse
# remove delay for exiting insert mode with ESC in Neovim
set -sg escape-time 10
# move tmux bar to top instead of bottom
set -g status-position top
# renumber windows if you close one
set -g renumber-windows on
# prefix - I to update latest plugins from tpm
set -g @plugin 'tmux-plugins/tpm'
# list of tmux plugins
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-resurrect' # persist tmux sessions after computer restart
set -g @plugin 'tmux-plugins/tmux-continuum' # automatically saves sessions for you every 15 minutes
# Catppuccin theme
# https://github.com/catppuccin/tmux
# Cons:
# - Doesn't have a sync panes like dracula
# - Actually I was able to implement this, see below
# Pros:
# - I feel my terminal waaaaay smoother/faster, not completely sure about this
# But could be due to all the refreshing and polling of data Dracula had to do
# I pinned to 0.3.0 beacuse a new version had breaking changes and my tmux bar
# looked like crap, spent hours trying to figure it out
set -g @plugin 'catppuccin/tmux#v0.3.0'
# set -g @plugin 'catppuccin/tmux#latest'
# or frappe, macchiato, mocha
set -g @catppuccin_flavor 'mocha'
# I use this for my custom tmux banner on the right side
# tmux set -g @catppuccin_directory_color "#04d1f9"
# Color of the ACTIVE window, windows are opened with ctrl+b c
set -g @catppuccin_window_current_color "#04d1f9"
set -g @catppuccin_window_current_background "#0D1116"
# Color of the rest of the windows that are not active
set -g @catppuccin_window_default_color "#013e4a"
set -g @catppuccin_window_default_background "#0D1116"
# The following 2 colors are for the lines that separate tmux splits
set -g @catppuccin_pane_active_border_style "fg=#027d95"
set -g @catppuccin_pane_border_style "fg=#a5afc2"
# # This is the classic colored tmux bar that goes across the entire screen
set -g @catppuccin_status_background "theme"
set -g @catppuccin_status_background "#0D1116"
#
# # default for catppuccin_session_color is #{?client_prefix,$thm_red,$thm_green}
# # https://github.com/catppuccin/tmux/issues/140#issuecomment-1956204278
set -g @catppuccin_session_color "#{?client_prefix,#987afb,#37f499}"
#
# # This sets the color of the window text, #W shows the application name
#
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#[fg=#ebfafa]#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#[fg=#ebfafa]#W"
#
# # Put this option below the '@catppuccin_window_current_text' option for it to
# # override it, otherwise it won't work
# # I got the 'window_zoomed_flag' tip from 'DevOps Toolbox' youtuber
# # https://youtu.be/GH3kpsbbERo?si=4ZoV090qVbble7np
#
# # Second option shows a message when panes are syncronized
set -g @catppuccin_window_current_text "#W#{?window_zoomed_flag,#[fg=#585c89] ( ),}#{?pane_synchronized,#[fg=#585c89] SYNCHRONIZED-PANES,}"
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_status_modules_left "session"
# As 'man tmux' specifies:
# Execute the first command if shell-command (run with /bin/sh) returns success or the second command otherwise
set -g @catppuccin_status_modules_right "null"
# `user` and `host` are kind of useless, dont change when you ssh to devices
# set -g @catppuccin_status_modules_right "directory user host"
set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_connect_separator "no"
# set -g @catppuccin_directory_text "#{pane_current_path}"
# This can be set to "icon" or "all" if set to "all" the entire tmux session
# name has color
# set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_fill "all"
#
# If you set this to off, the tmux line completely dissappears
set -g @catppuccin_status_default "on"
# set -g @plugin 'fabioluciano/tmux-tokyo-night'
set -g @theme_transparent_status_bar 'true'
set -g @theme_transparent_left_separator_inverse ''
set -g @theme_transparent_right_separator_inverse ''
set -g @theme_left_separator ''
set -g @theme_right_separator ''
set -g @theme_plugins 'datetime,weather,battery'
set -g @resurrect-capture-pane-contents 'on'
set -g @continuum-restore 'on'
# Zero-out escape time delay for quicker response
set -s escape-time 0
# Pane background color
set-window-option -g window-active-style bg=#021c31 # active pane
set-window-option -g window-style bg=terminal # inactive panes
# changes catppuccin theme color in choose-tree
set -wF mode-style "fg=#44FFb1,bg=#214969"
# Open panes in cwd
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# When pressing prefix+s to list sessions, I want them sorted by time
# That way my latest used sessions show at the top of the list
# -s starts with sessions collapsed (doesn't show windows)
# -Z zooms the pane (don't uderstand what this does)
# -O specifies the initial sort field: one of ‘index’, ‘name’, or ‘time’ (activity).
# https://unix.stackexchange.com/questions/608268/how-can-i-force-tmux-to-sort-my-sessions-alphabetically
#
# bind s choose-tree -Zs -O time
# bind s choose-tree -Zs -O time -y
bind s choose-tree -Zs -O time -F "#{session_windows}"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'