Skip to content

Instantly share code, notes, and snippets.

@even4void
Created May 27, 2025 11:34
Show Gist options
  • Save even4void/90e1491690fc9decbb447461e03af12b to your computer and use it in GitHub Desktop.
Save even4void/90e1491690fc9decbb447461e03af12b to your computer and use it in GitHub Desktop.
Tmux (3.5a) config file
set -g default-command "${SHELL}"
if-shell "hash infocmp >/dev/null 2>&1 && \
infocmp tmux-256color >/dev/null 2>&1" \
"set -gq default-terminal 'tmux-256color'" \
"set -gq default-terminal 'screen-256color'"
# set -gqa terminal-overrides ',*:Tc'
set -asq terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -asq terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
set -g allow-passthrough on
set -g allow-rename off
set -g automatic-rename off
set -g base-index 1
set -g buffer-limit 20
set -g display-time 1500
set -g focus-events on
set -g history-limit 20000
set -g mode-style reverse
set -g mouse on
set -g pane-border-format '#W:#P'
set -g remain-on-exit off
set -g renumber-windows on
set -g repeat-time 300
set -g set-clipboard off
set -g set-titles on
set -g set-titles-string "tmux ♯#S #{pane_current_command}"
set -g visual-activity off
set -s copy-command 'pbcopy'
set -s escape-time 0
set -wg clock-mode-colour brightwhite
set -wg mode-keys vi
set -wg monitor-activity on
set -wg pane-base-index 1
set -g status off
set-hook -g window-linked "if -F '#{==:#{session_windows},1}' 'set status off' 'set status on'"
set-hook -g window-unlinked "if -F '#{==:#{session_windows},1}' 'set status off' 'set status on'"
set-hook -g client-session-changed "if -F '#{==:#{session_windows},1}' 'set status off' 'set status on'"
set -g pane-active-border-style fg=brightwhite
set -g pane-border-style fg=brightblack
set -g status-interval 5
set -g status-justify left
set -g status-left ""
set -g status-position top
set -g status-right "#{?client_prefix,#[noreverse] N #[reverse],} #{?#{==:#{pane_current_command},ssh},#[noreverse] #{pane_current_command} #[reverse],#{pane_current_command}} ♯#S "
if '! [ -z "$SSH_TTY" ]' 'set -g status-right "#{?client_prefix,#[noreverse] N #[reverse],} #{?#{==:#{pane_current_command},ssh},#[noreverse] #{pane_current_command} #[reverse],#{pane_current_command}} #(whoami)@#h ♯#S "'
set -g status-style reverse
set -g message-command-style reverse
set -g message-style reverse
set -g window-status-current-format "#[bg=black,fg=white,reverse] #I#{?window_zoomed_flag,+,} "
set -g window-status-format "#[fg=dim] #I#{?pane_synchronized,~,} "
set -g window-status-separator "#[fg=dim]"
set -g window-status-activity-style blink
bind C-g setw synchronize-panes
bind C-m if -F '#{s/off//:mouse}' 'set -g mouse off; display-message "mouse: off"' 'set -g mouse on; display-message "mouse: on"'
bind C-y run "tmux capture-pane -S -3000; tmux save-buffer ~/tmp/tmux-\"$(date +%FT%T)\""
bind C-r source-file ~/.config/tmux/tmux.conf \; display-message "config: reload"
bind C-s if -F '#{s/off//:status}' 'set status off' 'set status on'
bind C-t if -F '#{s/off//:pane-border-status}' 'set pane-border-status off' 'set pane-border-status top'
bind C-x confirm-before -p "kill other sessions? (y/n)" 'kill-session -a'
bind C-w display-menu -x C -y C -H "fg=white,bg=black" \
-T '#[align=centre]Layout' \
'Resize Pane left' h { resize-pane -L 4 } \
'Resize Pane down' j { resize-pane -D 4 } \
'Resize Pane up' k { resize-pane -U 4 } \
'Resize Pane right' l { resize-pane -R 4 } \
'Tiled' + { select-layout tiled } \
'Main Horizontal' _ { select-layout main-horizontal } \
'Main Vertical' | { select-layout main-vertical } \
'Even Horizontal' \\ { select-layout even-horizontal } \
'Even Vertical' - { select-layout even-vertical }
bind C-p display-menu -x C -y C -H "fg=white,bg=black" \
-T '#[align=centre]Session' \
"New Session" S "command-prompt -p \"New session:\" \"new-session -A -s '%%'\"" \
"Rename Session" $ "command-prompt -p \"Rename session:\" \"rename-session '%%'\"" \
"Kill Session" x kill-session \
"Kill Other Session(s)" X "kill-session -a" \
"" \
"New Window" c new-window \
"Choose Window" w choose-window \
"Rename Window" W "command-prompt -p \"Rename window:\" \"rename-window '%%'\"" \
"Swap Window Right" l "swap-window -t -1" \
"Swap Window Left" h "swap-window -t +1" \
"Horizontal Split" v "split-window -h" \
"Vertical Split" s "split-window -v" \
"" \
"Swap Pane Up" j "swap-pane -U" \
"Swap Pane Down" k "swap-pane -D" \
"Break Pane" t break-pane \
"Join Pane" J "choose-window 'join-pane -h -s \"%%\"'"
bind : command-prompt
bind = choose-buffer
bind L switch-client -l
bind N swap-window -d -t '{next}'
bind P swap-window -d -t '{previous}'
bind S command-prompt -p "New Session:" "new-session -A -s '%%'"
bind S select-layout even-vertical
bind J choose-window 'join-pane -h -s "%%"'
bind V select-layout even-horizontal
bind j swap-pane -U
bind k swap-pane -D
bind l last-window
bind o selectp -t :.+
bind s split-window -v -c "#{pane_current_path}"
bind t break-pane
bind v split-window -h -c "#{pane_current_path}"
bind w choose-window
bind x confirm-before -p "kill session? (y/n)" kill-session
bind z resize-pane -Z
bind Escape copy-mode
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind -T copy-mode-vi 'C-v' send-keys -X rectangle-toggle \; send -X begin-selection
bind -T copy-mode-vi n send-keys -X search-forward "» "
bind -T copy-mode-vi p send-keys -X search-backward "» "
if-shell -b "[ -s '~/.local/bin/tmux-urlview.sh']" {
run-shell ~/.local/bin/tmux-urlview.sh
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment