# Change prefix key to C-a, found in in GNU Screen
unbind-key C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# Moving
bind u previous-window
bind i next-window

bind n "new-window -c '#{pane_current_path}'"

# Splits
bind h "split-window -hb -c '#{pane_current_path}'"
bind j "split-window -v -c '#{pane_current_path}'"
bind k "split-window -v -b -c '#{pane_current_path}'"
bind l "split-window -h -c '#{pane_current_path}'"

bind ';' "command-prompt"

# Reload config
bind C-r "source-file ~/.config/tmux/tmux.conf"

# Session binds
bind C-n "new-session -c '#{pane_current_path}' -s '#{b:pane_current_path}'"
bind C-x "set-option -g detach-on-destroy on; kill-session"
bind X "set-option -g detach-on-destroy off; kill-session; set-option -g detach-on-destroy on"

# Select mode
unbind-key -T copy-mode-vi y
unbind-key -T copy-mode-vi v
unbind-key -T copy-mode-vi V
unbind-key -T copy-mode-vi C-v
unbind-key -T copy-mode-vi C-c
unbind-key -T copy-mode-vi Escape

bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi V send-keys -X select-line
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi C-c send-keys -X cancel
bind-key -T copy-mode-vi Escape send-keys -X clear-selection

# vim: ft=tmux
