# set default prefix to C-a
unbind C-b
set -g prefix C-a

# refresh tmux conf
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"

# enable mouse mode
set -g mouse on

# not binded by default, but precautions
unbind v
unbind h

# bind to split windows into panes
bind v split-window -h -c "#{pane_current_path}"
bind h split-window -v -c "#{pane_current_path}"

# resize panes using prefix --> alt + arrow

# pane navigation, vim style without using prefix
bind -n C-h select-pane -L
bind -n C-j select-pane -D
bind -n C-k select-pane -U
bind -n C-l select-pane -R

# increase history limit, cus why not lol
set -g history-limit 100000

unbind n #DEFAULT KEY: move to next window
unbind w #DEFAULT KEY: change current window interactively

# create, and rename windows
bind n command-prompt "rename-window '%%'"
bind w new-window -c "#{pane_current_path}"

# move between windows using prefix --> number

# set base window number to be 1, same for panes
set -g base-index 1
set-window-option -g pane-base-index 1

# move between windows without prefix
bind -n M-j previous-window
bind -n M-k next-window

# set mode keys to be vim style
set-window-option -g mode-keys vi

# use system clipboard instead of a paste buffer
unbind -T copy-mode-vi Space; #Default for begin-selection
unbind -T copy-mode-vi Enter; #Default for copy-selection

bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel --clipboard"

# set kill window
bind q killp
