# set-option -g default-command "exec /usr/local/bin/bash --login"
set-option -g status-style bg=default
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"

# Enable mouse
set -g mouse on 

# Set the control character to Ctrl+Spacebar (instead of Ctrl+B)
set -g prefix C-space
unbind-key C-b
bind-key C-space send-prefix

# Set new panes to open in current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"

# Move 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-key -r H resize-pane -L 5
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r L resize-pane -R 5

# Pane movement between windows
bind-key m command-prompt -p "send pane to:"  "join-pane -t :'%%'"

# Disable escape time to remove delay in nvim
set -s escape-time 0

# True color support
set -g default-terminal "tmux-256color"
set-option -ga terminal-overrides ",*256col*:Tc"

# Allow OSC 11 background queries to pass through
set -g allow-passthrough on
set -ga terminal-features "*:osc7,RGB,usstyle,RGB"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'  # undercurl
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'  # truecolor underline

set -g status-style "fg=blue"
set -g window-status-current-style "fg=blue"
set -g pane-active-border-style "fg=blue"

setw -g mode-keys vi
bind -T copy-mode-vi 'v' send -X begin-selection
bind -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy"

# set -g status-right "#(date +'%I:%M %p')"
set -g status-right "#(date +'%A, %B %d, %Y')"

# Activate OFF mode
bind o \
    set prefix None \;\
    set key-table off \;\
    set status-style "fg=brightblack" \;\
    set window-status-current-style "fg=brightblack"

# Disable OFF mode
bind -T off O \
    set -u prefix \;\
    set -u key-table \;\
    set -u status-style \;\
    set -u window-status-current-style
