Skip to content

Instantly share code, notes, and snippets.

@even4void
Last active August 27, 2025 19:53
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 -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'
%if "#{>=:#{version},3.2}"
set-option -a terminal-features '*:RGB'
set -a terminal-features '*:usstyle'
setenv -g TMUX_HAS_POPUP 1
set -g allow-passthrough on
if-shell "uname | grep -q Darwin" \
"set -s copy-command 'pbcopy'" \
"set -s copy-command 'xsel -i'"
%endif
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-keys vi
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} #{session_alerts}"
set -g status-keys emacs
set -g visual-activity off
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-hook -g after-split-window 'select-layout -E'
set-hook -g after-kill-pane 'select-layout -E'
set-hook -g pane-exited 'select-layout -E'
set -g pane-active-border-style fg=brightwhite
set -g pane-border-style fg=brightblack
# is_many="if [ #{window_panes} -eq 1 ]; then exit 1; fi"
# set-hook -g pane-focus-in 'if-shell "$is_many" "selectp -P bg=white; run \"sleep 0.1\"; selectp -P bg=default"'
set -g status-interval 5
set -g status-justify left
set -g status-left ""
set -g status-right-length 60
set -g status-position top
set -g status-right "#[align=absolute-centre] %H:%M #[align=right]#{?client_prefix,#[noreverse] N #[reverse],} #(np) #{?#{==:#{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 -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
bind -r n next-window
bind -r p previous-window
bind : command-prompt
bind = choose-buffer
bind C command-prompt -p "New Session:" "new-session -A -s '%%'"
bind C-g setw synchronize-panes
bind C-l pipe-pane -o "cat >>~/tmp/#W.log" \; display "Logging window to ~/tmp/#W.log"
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-p run-shell -b '$HOME/.local/bin/tmux-fzf 2>&1'
bind C-r source-file ~/.config/tmux/tmux.conf \; display-message "Reloading config"
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-y run "tmux capture-pane -S -; tmux save-buffer ~/tmp/tmux-\"$(date +%FT%T)\""
bind C clock-mode
bind L switch-client -l
bind P choose-buffer -Z { paste-buffer -p -b '%%' } # bracketed paste
bind V choose-window 'join-pane -h -s "%%"'
bind X confirm-before -p "Kill other sessions(s)? (y/n)" 'kill-session -a'
bind b last-window
bind h swap-window -d -t '{previous}'
bind j swap-pane -U
bind k swap-pane -D
bind l swap-window -d -t '{next}'
bind o selectp -t :.+
bind s split-window -v -c "#{pane_current_path}"
bind t break-pane
bind u run-shell -b '$HOME/.local/bin/tmux-fzf-url.sh -u 2>&1'
bind v split-window -h -c "#{pane_current_path}"
bind w choose-window
bind x confirm-before -p "Kill current session? (y/n)" kill-session
bind z resize-pane -Z
bind q copy-mode
bind -T copy-mode-vi u send-keys -X halfpage-up
bind -T copy-mode-vi d send-keys -X halfpage-down
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi C-l send-keys -X clear-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 "» "
bind -T copy-mode-vi [ send-keys -X previous-prompt -o
bind -T copy-mode-vi ] send-keys -X next-prompt -o
bind -T copy-mode-vi / command-prompt -i -I "#{pane_search_string}" -p "(search down)" { send -X search-forward-incremental '%%%' }
bind -T copy-mode-vi ? command-prompt -i -I "#{pane_search_string}" -p "(search up)" { send -X search-backward-incremental '%%%' }
%if "#{!=:$EDITOR,}"
set editor $EDITOR
bind -T copy-mode-vi C-f send-keys -X pipe-and-cancel 'xargs -I% tmux send-keys $EDITOR Space % Enter'
%endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment