#!/usr/bin/env bash

set-option -sa terminal-overrides ",xterm*:Tc"
set -g mouse on

unbind C-b
set -g prefix C-x
bind C-x send-prefix

# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on

set -g @plugin 'catppuccin/tmux#v1.0.1'

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'

# Better split window keybind and same directory for new panes
unbind '"'
unbind %
bind - split-window -v -c "#{pane_current_path}"
bind _ split-window -h -c "#{pane_current_path}"

bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R

# Nightfox colors for Tmux
# Style: carbonfox
# Upstream: https://github.com/edeneast/nightfox.nvim/raw/main/extra/carbonfox/carbonfox.tmux
# set -g mode-style "fg=#0c0c0c,bg=#b6b8bb"
# set -g message-style "fg=#0c0c0c,bg=#b6b8bb"
# set -g message-command-style "fg=#0c0c0c,bg=#b6b8bb"
# set -g pane-border-style "fg=#b6b8bb"
# set -g pane-active-border-style "fg=#78a9ff"
# set -g status "on"
# set -g status-justify "left"
# set -g status-style "fg=#b5b8bb,bg=#0c0c0c"
# set -g status-left-length "100"
# set -g status-right-length "100"
# set -g status-left-style NONE
# set -g status-right-style NONE
# set -g status-left ""
# set -g status-right "#[fg=#0c0c0c,bg=#b6b8bb,,nobold,nounderscore,noitalics] #W #[fg=#0c0c0c,bg=#78a9ff,bold] #S "
# setw -g window-status-activity-style "underscore,fg=#7b7c7e,bg=#0c0c0c"
# setw -g window-status-separator ""
# setw -g window-status-style "NONE,fg=#7b7c7e,bg=#0c0c0c"
# setw -g window-status-format "#[fg=#0c0c0c,bg=#0c0c0c,nobold,nounderscore,noitalics]#[default] #I #{b:pane_current_path} "
# setw -g window-status-current-format "#[fg=#0c0c0c,bg=#b6b8bb,bold] #I #{b:pane_current_path} "

# Catpuccin Theme....
set -g status-right "#{E:@catppuccin_status_application}#{E:@catppuccin_status_session}"
set -g status-left ""
set -g @catppuccin_pane_active_border_style "fg=#{@thm_peach}"
set -g @catppuccin_window_current_background "#{@thm_lavender}"
set -g @catppuccin_window_status_style "basic"

set -g @catppuccin_window_default_text " #W"
set -g @catppuccin_window_current_text " #W"
set -g @catppuccin_window_status "icon"
set -g @catppuccin_window_current_background "#{@thm_peach}"

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