# Tmux Configuration for Claude Code Agent Monitoring
# Usage: tmux -f provisioning/tools/claude-code-tmux.conf

# Enable mouse support
set -g mouse on

# Increase scrollback buffer
set-option -g history-limit 50000

# Enable vi mode for easier navigation
set-window-option -g mode-keys vi

# Bind vi-style copy mode keys
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection

# Easy split commands
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# Easy pane navigation (vim-style)
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# Pane resizing
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

# Quick reload config
bind r source-file ~/.tmux.conf \; display "Config Reloaded!"

# Status bar configuration
set -g status-bg colour235
set -g status-fg colour136
set -g status-left-length 40
set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-right "#[fg=cyan]%d %b %R"
set -g status-interval 60
set -g status-justify centre

# Window status
setw -g window-status-current-style fg=white,bg=red,bold

# Pane borders
set -g pane-border-style fg=colour238
set -g pane-active-border-style fg=colour136

# Enable copy to system clipboard (macOS)
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"

# Scroll without entering copy mode
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M

# Quick access to monitoring layout
bind M source-file ~/.tmux/layouts/claude-monitoring.conf
