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

# Set up window title support to be the machine and whatever window we're
# using; if using session 1 on machine hostname, and looking at window 3 whose
# name is blog, this looks like "1@hostname 3:blog"
set -g set-titles 'on'
set -g set-titles-string '#S@#T #I:#W'

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# switch panes using Alt-arrow without prefix
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D

# Enable mouse mode (tmux 2.1 and above)
set -g mouse on

# don't rename windows automatically
set-option -g allow-rename on

# rename with r
bind-key r command-prompt -I "#W" "rename-window '%%'"

# use vim keybindings in copy mode
set-option -g mode-keys vi

# setup 'v' to begin selection like in Vim
#bind-key -t vi-copy v begin-selection
#bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"

# Start window indices at 1 rather than 0; easier switching (C-b 1, C-b 2, ...)
set -g base-index 1

set -g default-terminal "xterm-256color"

# Highlight windows with activity in the status line.
setw -g monitor-activity 'on'

# Escape-time makes pressing escape not be an escape key within tmux
set -sg escape-time 0

# Allow resizing panes quickly with <prefix> shift+arrows
bind C-S-h resize-pane -L 10
bind C-S-l resize-pane -R 10
bind C-S-k resize-pane -U 10
bind C-S-j resize-pane -D 10

bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1
