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

# Vim window split commands
bind v split-window -h -c "#{pane_current_path}"
bind s split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %

# Enable mouse mode
set -g mouse on

# Switch panes with vim keybindings
bind k selectp -U
bind j selectp -D
bind h selectp -L
bind l selectp -R

# Move panes with vim keybindings
bind C-k resize-pane -U
bind C-j resize-pane -D
bind C-h resize-pane -L
bind C-l resize-pane -R

# Move pane to the far right/left/bottom/top
# Source: https://superuser.com/questions/1601701/tmux-how-to-move-current-pane-to-far-left-right-up-down-like-in-vim
bind H splitw -fhb \; swapp -t ! \; killp -t !
bind L splitw -fh  \; swapp -t ! \; killp -t !
bind J splitw -fv  \; swapp -t ! \; killp -t !
bind K splitw -fvb \; swapp -t ! \; killp -t !

# Vim quit key
bind q killp
unbind x

# Disable auto renaming panes
set -g allow-rename off

# Tmux Plugin Manager (TPM)
# To install plugins open tmux and type Prefix+I
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'erikw/tmux-powerline'

# Install tmux themes
set -g @plugin 'wfxr/tmux-power'
set -g @tmux_power_theme 'snow'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
