# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on

# Use | and - to split a window vertically and horizontally instead of " and % respoectively
unbind '"'
unbind %
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"

# Vim Navigation
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
  | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"

is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
  | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"

bind -n C-h run "($is_vim && tmux send-keys C-h) || \
                 tmux select-pane -L"

bind -n C-j run "($is_vim && tmux send-keys C-j)  || \
                 ($is_fzf && tmux send-keys C-j) || \
                 tmux select-pane -D"

bind -n C-k run "($is_vim && tmux send-keys C-k) || \
                 ($is_fzf && tmux send-keys C-k)  || \
                 tmux select-pane -U"

bind -n C-l run "($is_vim && tmux send-keys C-l) || \
                 tmux select-pane -R"

bind-key -n C-\  if-shell "$is_vim" "send-keys C-\\" "select-pane -l"

# This tmux statusbar config was created by tmuxline.vim
# on Sun, 27 Nov 2022

set -g status-justify "left"
set -g status "on"
set -g status-left-style "none"
set -g message-command-style "fg=#d75fd7,bg=#4e4e4e"
set -g status-right-style "none"
set -g pane-active-border-style "fg=#875faf"
set -g status-style "none,bg=#3a3a3a"
set -g message-style "fg=#d75fd7,bg=#4e4e4e"
set -g pane-border-style "fg=#4e4e4e"
set -g status-right-length "100"
set -g status-left-length "100"
setw -g window-status-activity-style "none"
setw -g window-status-separator ""
setw -g window-status-style "none,fg=#c6c6c6,bg=#3a3a3a"
set -g status-left "#[fg=#bcbcbc,bg=#875faf] #S #[fg=#875faf,bg=#3a3a3a,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#4e4e4e,bg=#3a3a3a,nobold,nounderscore,noitalics]#[fg=#d75fd7,bg=#4e4e4e] %Y-%m-%d  %H:%M #[fg=#875faf,bg=#4e4e4e,nobold,nounderscore,noitalics]#[fg=#bcbcbc,bg=#875faf] #h "
setw -g window-status-format "#[fg=#c6c6c6,bg=#3a3a3a] #I #[fg=#c6c6c6,bg=#3a3a3a] #W "
setw -g window-status-current-format "#[fg=#3a3a3a,bg=#4e4e4e,nobold,nounderscore,noitalics]#[fg=#d75fd7,bg=#4e4e4e] #I #[fg=#d75fd7,bg=#4e4e4e] #W #[fg=#4e4e4e,bg=#3a3a3a,nobold,nounderscore,noitalics]"