# Update environment on reconnect
set -g update-environment "DISPLAY WINDOWID SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION"

# Custom binds
bind K confirm kill-server
bind X confirm kill-window
bind ^[ copy-mode
bind R source-file ~/.tmux.conf \; display-message "  Config reloaded.."

# Scrollback
set -g history-limit 10000

# Start indexing from 1
set -g base-index 1
set -g pane-base-index 1

# Terminal emulator window title
set -g set-titles on
set -g set-titles-string '#h:#S:#I.#P #W'

# Set a 256color $TERM variable so programs inside tmux know they can use 256
# colors
set -g default-terminal screen-256color

# Activity
setw -g monitor-activity on
set -g visual-activity on

# Autorename new tabs automatically
setw -g automatic-rename on

# Color scheme
source-file ~/.tmux/tmux-solarized-256.conf

# Provide a statusbar
set -g window-status-current-bg colour33
set -g window-status-current-fg colour235
set -g window-status-current-attr bold
set -g status-interval 60
set -g status-left-length 30
set -g status-left '/#S/ '
set -g status-right '#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=colour166]%H:%M#[default]'

# Advanced mouse mode from http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/
# Toggle mouse on
bind m \
    set -g mode-mouse on \;\
    set -g mouse-resize-pane on \;\
    set -g mouse-select-pane on \;\
    set -g mouse-select-window on \;\
    display 'Mouse: ON'

# Toggle mouse off
bind M \
    set -g mode-mouse off \;\
    set -g mouse-resize-pane off \;\
    set -g mouse-select-pane off \;\
    set -g mouse-select-window off \;\
    display 'Mouse: OFF'
