# True color support (crucial for kitty + neovim)
set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"

# Super important for osc52, images, hyperlinks, etc.
set -g allow-passthrough on

# Enable mouse support
set -g mouse on

# Renumber windows when one is closed
set -g renumber-windows on

# Set prefix to C-Space
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix

# Set status bar
#set -g status-bg pink
# Tokyo Night Moon color palette
set -g mode-style "fg=#82aaff,bg=#3b4261"

set -g message-style "fg=#82aaff,bg=#3b4261"
set -g message-command-style "fg=#82aaff,bg=#3b4261"

set -g pane-border-style "fg=#82aaff"
set -g pane-active-border-style "fg=#b172b0"

set -g status-style "fg=#b172b0,bg=#3b4261"
set -g status-bg "#222436"

set -g status-left "#[fg=#1b1d2b,bg=#b172b0,bold] #S #[fg=#1b1d2b,bg=#b172b0,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#1b1d2b,bg=#82aaff,nobold,nounderscore,noitalics]#[fg=#b172b0,bg=#3b4261] #{prefix_highlight} #[fg=#3b4261,bg=#3b4261]#[fg=#b172b0,bg=#3b4261] %Y/%m/%d  %I:%M %p #[fg=#82aaff,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#1b1d2b,bg=#b172b0,bold,italics] #h "

setw -g window-status-format "#[fg=#1b1d2b,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#82aaff,bg=#3b4261] #I  #W #F #[fg=#1b1d2b,bg=#3b4261,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=#1b1d2b,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#b172b0,bg=#3b4261,bold] #I  #W #F #[fg=#3b4261,bg=#3b4261,nobold,nounderscore,noitalics]"

setw -g window-status-separator ""

# Increase scrollback buffer
set -g history-limit 50000

# Display tmux messages for 4 seconds
set -g display-time 4000

# Refresh status bar every 5 seconds
set -g status-interval 5

# Focus events for neovim autoread
set -g focus-events on

# Aggressive resize (useful for multi-monitor)
setw -g aggressive-resize on

# Reduce escape time (better for neovim)
set -sg escape-time 10

# Split panes using | and -
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %

# Reload config
bind r source-file ~/.config/tmux/tmux.conf \; display "Config reloaded!"

# Switch panes with vim keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# Resize panes with vim keys
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

# Vi mode for copy mode
setw -g mode-keys vi
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
