# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# vim keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# start ajacent terminals with same path
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"

# set variables
set -g mouse on
set -g history-limit 100000

set -g base-index 1
setw -g pane-base-index 1

set -gq allow-passthrough on
set -g visual-activity off

# fix undercurls: https://github.com/folke/tokyonight.nvim#fix-undercurls-in-tmux
set -g default-terminal "${TERM}"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'

# plugins
# got from: https://github.com/tmux-plugins/tpm/blob/master/docs/automatic_tpm_installation.md, changed to a more sensible install dir
if "test ! -d ~/.local/share/tmux/plugins/tpm" \
   "run 'git clone https://github.com/tmux-plugins/tpm ~/.local/share/tmux/plugins/tpm && ~/.local/share/tmux/plugins/tpm/bin/install_plugins'"

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin "janoamaral/tokyo-night-tmux"

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