# set scroll history to 100,000 lines
set-option -g history-limit 100000

# modern colors
set -g default-terminal "tmux-256color"
# set -ga terminal-overrides ",alacritty:Tc"

# copy to X clipboard
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe 'xclip -in -selection clipboard &> /dev/null'
bind -T copy-mode-vi Enter send-keys -X cancel

# shortcut for moving tmux buffer to clipboard
# useful if you've selected with the mouse
bind-key -nr C-y run "tmux show-buffer | xclip -in -selection clipboard &> /dev/null"

# Avoid ESC delay
set -s escape-time 0

# Fix titlebar
set -g set-titles on
set -g set-titles-string "#T"

# VIM mode
set -g mode-keys vi

# Mouse friendly
set -g mouse on

# Increase tmux messages display duration from 750ms to 4s
set -g display-time 4000

# Focus events enabled for terminals that support them
set -g focus-events on

# Move between panes
bind t select-pane -L
bind e select-pane -D
bind s select-pane -U
bind h select-pane -R

# Avoid date/time taking up space
set -g status-right ''
set -g status-right-length 0


# Change the status bar color
set -g status-style bg=colour235,fg=colour250

# Scratch session  (toggle pane)
bind-key g display-popup -E "tmux new-session -A -s scratch"

# split panes using - and '
bind - split-window -h
bind "'" split-window -v
unbind '"'
unbind %

bind -n M-tab last-window
bind tab last-pane

bind -n M-b choose-buffer

# Plugins
# I don't see the point of having a plugin manager for tmux
# Just clone the repo and source it
#run-shell "bash $HOME/.config/tmux/plugins/set_title.sh"

run ~/.config/tmux/plugins/tmux-prefix-highlight/prefix_highlight.tmux

# Status bar
set -g status-right '#(gitmux "#{pane_current_path}")'
# set -g status-right "#{prefix_highlight} | %a %Y-%m-%d %H:%M"
