.tmux.conf 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. set -g mouse on
  2. set -g base-index 1
  3. setw -g pane-base-index 1
  4. set -g history-limit 50000
  5. set -s escape-time 0
  6. set -g focus-events on
  7. set -g extended-keys on
  8. set -g display-time 4000
  9. set -g status-interval 5
  10. setw -g aggressive-resize on
  11. set -g status-keys emacs
  12. # Status bar as a tab bar
  13. set -g status-position bottom
  14. set -g status-style 'bg=colour235 fg=colour7'
  15. set -g status-left ' '
  16. # prefix-highlight (native #{client_prefix} — no plugin needed) + copy/sync indicators.
  17. # Indicators prepend to status-right so [+] [d] stay flush-right (mouse math intact).
  18. set -g status-right '#{?client_prefix,#[bg=colour3#,fg=colour235#,bold] ^B #[default] ,}#{?#{==:#{pane_mode},copy-mode},#[bg=colour2#,fg=colour235#,bold] COPY #[default] ,}#{?pane_synchronized,#[bg=colour1#,fg=colour15#,bold] SYNC #[default] ,} [+] [d] '
  19. # Tab label = the app's pane title (Claude Code sets a good one), trimmed to 24;
  20. # falls back to the running command for bare shells (where pane_title == hostname).
  21. # #{E:...} forces the stored format in @wtitle to expand. Replaces #W to dodge the
  22. # window-name pollution (apps leak junk like "2.1.156" into the window NAME).
  23. set -g @wtitle '#{?#{||:#{==:#{pane_title},},#{==:#{pane_title},#{host}}},#{pane_current_command},#{=/24/…:pane_title}}'
  24. # Tab: index:(NpZ) title — pane count + zoom flag prefixed in parens, only when split.
  25. setw -g window-status-format ' #I:#{?#{>:#{window_panes},1},(#{window_panes}p#{?window_zoomed_flag,Z,}) ,}#{E:@wtitle} '
  26. setw -g window-status-current-format ' #I:#{?#{>:#{window_panes},1},(#{window_panes}p#{?window_zoomed_flag,Z,}) ,}#{E:@wtitle} '
  27. setw -g window-status-current-style 'bg=colour4 fg=colour15 bold'
  28. set -g pane-border-status top
  29. # Click [+] to create new tab, [d] to detach
  30. bind -n MouseDown1StatusRight run-shell -b '\
  31. x="#{mouse_x}"; \
  32. w=$(tmux display-message -p "#{window_width}"); \
  33. pos=$((w - x)); \
  34. if [ "$pos" -ge 0 ] && [ "$pos" -le 3 ]; then \
  35. tmux detach-client; \
  36. elif [ "$pos" -ge 4 ] && [ "$pos" -le 8 ]; then \
  37. tmux new-window; \
  38. fi'
  39. # Close tab: just type exit (or Ctrl-d) in the shell
  40. # Window management menu (prefix + w)
  41. bind w display-menu -T "Windows" \
  42. "New Window" n "new-window" \
  43. "Kill Window" k "kill-window" \
  44. "Next Window" l "next-window" \
  45. "Prev Window" h "previous-window" \
  46. "" \
  47. "Horizontal Split" - "split-window -v" \
  48. "Vertical Split" | "split-window -h" \
  49. "" \
  50. "Kill Pane" x "kill-pane" \
  51. "Zoom Pane" z "resize-pane -Z" \
  52. "" \
  53. "Choose Session" s "choose-tree -s"
  54. bind-key -n M-w new-window
  55. # Fork Claude Code session into a new window
  56. bind R source-file ~/.tmux.conf \; display "Reloaded"
  57. bind f run-shell 'T="Fork ($(date "+%a %H:%M"))"; tmux new-window -a -n "$T" "claude --dangerously-skip-permissions --continue --fork-session"; tmux select-pane -T "$T"'