# Automatically start each session with two panes in the same directory if-shell '[[ ! -z "$TMUX" ]]' '' 'new-session -d -s default -c "$HOME" \; split-window -h -c "$HOME" \; select-pane -t 0'

set-environment -g PATH "/opt/homebrew/bin:/bin:/usr/bin"
if "test ! -d ~/.tmux/plugins/tpm" \
   "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"

# prefix + r to reload config
bind r source-file "${XDG_CONFIG_HOME}/tmux/tmux.conf" \; display "Source file reloaded!"

# Set prefic to ctrl + space
unbind C-space
set -g prefix C-space
bind C-space send-prefix

# Increase tmux history from 2k to 5k
set-option -g history-limit 5000

# Create new windows at current path
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"

# Resizing
bind -r C-j resize-pane -D 15
bind -r C-k resize-pane -U 15
bind -r C-l resize-pane -R 15
bind -r C-l resize-pane -L 15

# Increase the time after 'prefix'
set-option -sg escape-time 10

# Change the default color scheme
set -g status-bg colour235
set -g status-fg white

# Set the status bar color
set -g status-bg colour235
set -g status-fg white

# Pane border colors (using a different approach)
set -g pane-border-style 'fg=white,bg=colour235'
set -g pane-active-border-style 'fg=green,bg=colour236'

# Window status colors
set -g window-status-style 'fg=white,bg=colour235'
set -g window-status-current-style 'fg=green,bg=colour236'

set -g mouse on
set -ga terminal-overrides ",*-256color:Tc"

# Start Windows and Panes index at 1
set -g base-index 1
set -g pane-base-index 1
set-option -g renumber-windows on

set-option -g focus-events on


# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'sainnhe/tmux-fzf'

run '~/.tmux/plugins/tpm/tpm'
