# Core
set -ga terminal-overrides     ",st-256color*:Tc"
set-option -g default-terminal "st-256color"
set -s escape-time 0
set -g history-limit 50000
set -g base-index 1
set-window-option -g mode-keys vi
set-option -g status-position top
set -g status-left-length 50
set-option -g set-clipboard on

# Keybindings
bind r source-file ~/.config/tmux/tmux.conf

bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'

bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l

bind -n M-h previous-window
bind -n M-j switch-client -p
bind -n M-k switch-client -n
bind -n M-l next-window

bind -n M-H swap-window -d -t -1
bind -n M-L swap-window -d -t +1

bind -n M-q kill-window
bind -n M-Enter new-window
bind -n M-Tab last-window

run-shell -b 'for i in $(seq 0 9); do tmux bind -n "M-$i" select-window -t $i; done'

# Theme
source-file ~/.config/tmux/themes/monochrome.conf

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

set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.local/share/tmux/plugins'
run '~/.local/share/tmux/plugins/tpm/tpm'
