-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.tmux.conf
More file actions
210 lines (181 loc) · 7.48 KB
/
.tmux.conf
File metadata and controls
210 lines (181 loc) · 7.48 KB
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
###############
### options ###
###############
set -g prefix C-d
set -g history-limit 8000
set -g base-index 1
set -g pane-base-index 1
set -g status-interval 2
set -g status-keys vi
set -g mode-keys vi
set -g history-file /tmp/tmux.history
# shell
set -g default-shell /usr/bin/zsh
set -g default-command /usr/bin/zsh
set -g display-panes-time 3000
set -g display-time 1000
set -s escape-time 10
set -g xterm-keys off
set -g set-titles on
set -g automatic-rename on
set -g renumber-windows on
set -g exit-unattached off
set -g mouse on
set -s focus-events on
set -sg repeat-time 300
# term
set -g default-terminal "${TERM}"
set-option -ga terminal-overrides "*:Tc"
# activity
set -g monitor-activity on
set -g visual-activity off
# size windows based on clients looking at that window
setw -g aggressive-resize on
# enable Yazi's image preview
set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
# for hyprland
set -ga update-environment HYPRLAND_INSTANCE_SIGNATURE
################
### bindings ###
################
# C-m = Enter
# C-i = Tab
# C-h = Backspace
# C-[ = Escape
# C-j = NewLine
tmux_scripts="$HOME/.zsh.d/scripts"
# tmux command
bind : command-prompt
# reload configuration
bind -r r source-file "$HOME/.tmux.conf" \; display-message "$HOME/.tmux.conf reloaded"
# pane — create
bind -r - split-window -v -c "#{pane_current_path}"
bind -r \\ split-window -h -c "#{pane_current_path}"
bind -r _ run-shell "$tmux_scripts/new-pane-ssh.sh -v"
bind -r \| run-shell "$tmux_scripts/new-pane-ssh.sh -h"
# pane — navigate
bind -n C-s last-pane
bind -n C-o select-pane -t '{next}'
# pane — resize
bind -r z resize-pane -Z
bind -r H command-prompt -p "Push left by:" "resize-pane -L '%%'"
bind -r J command-prompt -p "Push down by:" "resize-pane -D '%%'"
bind -r K command-prompt -p "Push up by:" "resize-pane -U '%%'"
bind -r L command-prompt -p "Push right by:" "resize-pane -R '%%'"
# pane — manage
bind -r p command-prompt -p "Rename pane:" "set-option -p @pane_name '%%'"
bind -r T command-prompt -p "Join pane from:" "join-pane -bh -s '%%'"
bind -r t command-prompt -p "Send pane to:" "join-pane -dh -t '%%'"
bind -r ] command-prompt -p "Swap pane with:" "swap-pane -d -t '%%'"
bind -r b break-pane
bind -r [ rotate-window
bind -r < select-pane -d \; display-message "Input disabled"
bind -r > select-pane -e \; display-message "Input enabled"
bind -r y setw synchronize-panes
bind -r C-o kill-pane -a
bind -r q display-panes
bind -n C-x kill-pane
# window — navigate
bind -r 0 select-window -t 0
bind -r 1 select-window -t 1
bind -r 2 select-window -t 2
bind -r 3 select-window -t 3
bind -r 4 select-window -t 4
bind -r 5 select-window -t 5
bind -r 6 select-window -t 6
bind -r 7 select-window -t 7
bind -r 8 select-window -t 8
bind -r 9 select-window -t 9
bind -n C-p last-window
bind -n C-u previous-window
bind -n C-n next-window
bind -r a select-window -t '{start}'
bind -r l select-window -t '{end}'
bind -r f command-prompt -p "Find window:" "find-window '%%'"
# window — manage
bind -r c new-window -c "#{pane_current_path}"
bind -r n command-prompt -p "Rename window:" "rename-window -- '%%'"
bind -r s command-prompt -p "Swap window with:" "swap-window -d -t '%%'"
bind -r m command-prompt -p "Move window to:" "move-window -t '%%'"
bind -r O kill-window -a
# session
bind -r N command-prompt -p "Rename session:" "rename-session -- '%%'"
bind -r C-n switch-client -n
bind -r C-c command-prompt -p "Create session:" "new -A -s '%%'"
bind -r C-t command-prompt -p "Switch session:" "switch-client -t %%"
bind -r C-d detach
# copy mode
bind -r Enter copy-mode
bind -r v paste-buffer
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi V send-keys -X select-line
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"
# misc
bind -r M show-messages
bind -r ? list-keys
bind -r C-b set-option status
bind -r E new-window sh -c '$EDITOR $HOME/.tmux.conf'
##############
### themes ###
##############
# One Dark
tmux_color_bg="#282c34"
tmux_color_fg="#aab2bf"
tmux_color_black="#282c34"
tmux_color_gray="#5c6370"
tmux_color_red="#e06c75"
tmux_color_yellow="#e5c07b"
tmux_color_green="#98c379"
tmux_color_blue="#61afef"
tmux_color_cyan="#3e4452"
tmux_color_magenta="#c6aae8"
tmux_font_style="bold"
# format strings
tmux_reset="#[bg=default fg=${tmux_color_gray} ${tmux_font_style}]"
tmux_separator="#[bg=default fg=${tmux_color_black} ${tmux_font_style}]/"
tmux_time="#[fg=${tmux_color_blue} bg=default ${tmux_font_style}]%H:%M"
tmux_host="#[fg=${tmux_color_blue} bg=default ${tmux_font_style}]#H"
tmux_session="#[fg=${tmux_color_blue} bg=default ${tmux_font_style}]#S"
tmux_window="#[fg=${tmux_color_blue} bg=default ${tmux_font_style}]#W"
tmux_cpu="#($tmux_scripts/cpu.sh ${tmux_font_style})"
tmux_memory="#($tmux_scripts/memory.sh ${tmux_font_style})"
tmux_disk="#($tmux_scripts/disk.sh ${tmux_font_style})"
tmux_temp="#($tmux_scripts/temp.sh ${tmux_font_style})"
tmux_uptime="#[fg=${tmux_color_blue} bg=default ${tmux_font_style}]#($tmux_scripts/uptime.sh)"
tmux_ip="#[fg=${tmux_color_blue} bg=default ${tmux_font_style}]#(cat /tmp/ip_address 2>/dev/null || hostname -I | awk '{print $1}')"
tmux_hosts="#[fg=${tmux_color_blue} bg=default ${tmux_font_style}]#(cat /tmp/live_hosts 2>/dev/null|wc -l)"
tmux_index="#I#{?@pane_name,:#W.#{@pane_name},}"
tmux_current_index="#I:#W#{?@pane_name,.#{@pane_name},}"
tmux_prefix_style="#[fg=${tmux_color_green} bg=default ${tmux_font_style}]"
tmux_zoomed_style="#[fg=${tmux_color_yellow} bg=default ${tmux_font_style}]"
tmux_sync_style="#[fg=${tmux_color_yellow} bg=default ${tmux_font_style}]"
tmux_zoom_sync_style="#[fg=${tmux_color_red} bg=default ${tmux_font_style}]"
# messages
set -g message-style "bg=default,fg=${tmux_color_blue},align=left,${tmux_font_style}"
set -g message-command-style "bg=default,fg=${tmux_color_fg},align=left,${tmux_font_style}"
# pane border (styles: simple, double, heavy, number)
set -g pane-border-lines simple
set -g pane-border-style "fg=${tmux_color_gray}"
set -g pane-active-border-style "fg=${tmux_color_gray}"
# statusline
set -g status on
set -g status-position bottom
set -g status-justify left
set -g status-left-length 100
set -g status-right-length 100
set -g status-style "bg=default,fg=${tmux_color_fg}"
set -g status-left "${tmux_session}@${tmux_host} ${tmux_separator} "
set -g status-right "${tmux_reset}C${tmux_cpu} ${tmux_reset}M${tmux_memory} ${tmux_reset}D${tmux_disk} ${tmux_reset}T${tmux_temp} ${tmux_separator} ${tmux_time}"
# window style
set -g window-status-separator ""
set -g window-status-style "bg=default,fg=${tmux_color_fg},${tmux_font_style}"
set -g window-status-current-style "bg=default,fg=white"
set -g window-status-activity-style "bg=default,fg=${tmux_color_fg},${tmux_font_style}"
set -g window-status-format "#[fg=${tmux_color_gray} bg=default ${tmux_font_style}]#{?window_zoomed_flag,#{?pane_synchronized,${tmux_zoom_sync_style}${tmux_index},${tmux_zoomed_style}${tmux_index}} ,#{?pane_synchronized,${tmux_sync_style}${tmux_index},${tmux_index}} }"
set -g window-status-current-format "#[fg=${tmux_color_blue} bg=default ${tmux_font_style}]#{?client_prefix,${tmux_prefix_style}${tmux_current_index} ,#{?window_zoomed_flag,#{?pane_synchronized,${tmux_zoom_sync_style}${tmux_current_index},${tmux_zoomed_style}${tmux_current_index}} ,#{?pane_synchronized,${tmux_sync_style}${tmux_current_index},${tmux_current_index}} }}"
# mode
set -g clock-mode-colour "${tmux_color_blue}"
set -g mode-style "bg=${tmux_color_black},fg=white,${tmux_font_style}"