Skip to content

Instantly share code, notes, and snippets.

@Fatpandac
Last active July 20, 2026 09:51
Show Gist options
  • Select an option

  • Save Fatpandac/4b86c2a653aecafb4945727d7420a3a4 to your computer and use it in GitHub Desktop.

Select an option

Save Fatpandac/4b86c2a653aecafb4945727d7420a3a4 to your computer and use it in GitHub Desktop.
set-option -sg escape-time 10
set-option -g focus-events on
set -g visual-activity off
set -g base-index 1
set -g allow-passthrough on
setw -g pane-base-index 1
set -g renumber-windows on
set -g default-terminal "tmux-256color"
set -as terminal-features ",*:RGB"
set -g set-clipboard on
set -g history-limit 50000
set -g extended-keys on
set -g extended-keys-format csi-u
set -g prefix C-a
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'fatpandac/agentbar'
unbind [
bind Escape copy-mode
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-selection
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind i display-popup -w 70% -h 70% -d '#{pane_current_path}'
# fzf 选 ~/Repo、~/Work 下的 git 仓库,创建/切换 session
bind f display-popup -E -w 60% -h 60% 'c="$HOME/.cache/tmux-repos"; scan() { fd -H -I -t d --max-depth 6 --prune -E node_modules "^\.git$" ~/Repo ~/Work 2>/dev/null | sed "s|/\.git/$||;s|^$HOME/||" | sort > "$c.tmp" && mv "$c.tmp" "$c"; }; [ -s "$c" ] || scan; (scan &); dir=$(fzf --prompt="repo> " < "$c") && dir="$HOME/$dir" && { [ -d "$dir" ] || { tmux display "gone: $dir"; exit; }; } && name=$(basename "$dir" | tr ".:" "__") && (tmux has-session -t "=$name" 2>/dev/null || tmux new-session -ds "$name" -c "$dir") && tmux switch-client -t "=$name"'
bind | split-window -hc "#{pane_current_path}"
bind - split-window -vc "#{pane_current_path}"
bind -r "<" swap-window -d -t -1
bind -r ">" swap-window -d -t +1
bind -r t if-shell 'tmux list-windows -t "#S" | grep -qw "btop"' \
'run-shell "tmux select-window -t "#S":btop"' \
'run-shell "tmux new-window -t "#S" -n btop \"btop\""'
bind s choose-session
bind r source-file ~/.tmux.conf \; display 'Reload!'
# theme
set -g status-style "bg=#2e3b4e,fg=white"
set -g status-interval 1
set -g status-right "#(cd #{pane_current_path} && git rev-parse --abbrev-ref HEAD 2>/dev/null) "
set -g status-right-length 120
set -g status-left " %H:%M:%S | "
set -g status-left-length 120
set -g detach-on-destroy off
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment