# switch to screen behaviour
set -g prefix C-a
unbind C-b
bind C-a send-prefix

# switch to the last active window
bind-key C-a last-window

# start with 1
set -g base-index 1

# set terminal
#set -g default-terminal "screen-256color"
# set special terminal, see http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/FAQ
set -g default-terminal "screen-it"
set -g default-shell "/bin/zsh"

# This configuration file binds many vi- and vim-like bindings to the
# appropriate tmux key bindings.  Note that for many key bindings there is no
# tmux analogue.  This is intended for tmux 1.3, which handles pane selection
# differently from the previous versions

# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind s split-window -v
bind v split-window -h

# move around panes with hjkl, as one would in vim after pressing ctrl-w
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by, only
# one at a time can be slow
bind < resize-pane -L 1
bind > resize-pane -R 1
bind - resize-pane -D 1
bind + resize-pane -U 1

# bind : to command-prompt like vim
# this is the default in tmux already
bind : command-prompt

# vi-style controls for copy mode
setw -g mode-keys vi

# confirm before killing a window or the server
bind-key & confirm kill-window
bind-key K confirm kill-server

# toggle statusbar
bind-key b set-option status

# send the prefix to client inside window (ala nested sessions)
bind-key a send-prefix

# open a man page in new window
bind / command-prompt "split-window 'exec man %%'"

# # Other key bindings.
bind F1 selectw -t:10
bind F2 selectw -t:11
bind F3 selectw -t:12
bind F4 selectw -t:13
bind F5 selectw -t:14
bind F6 selectw -t:15
bind F7 selectw -t:16
bind F8 selectw -t:17
bind F9 selectw -t:18
bind F10 selectw -t:19
bind F11 selectw -t:20
bind F12 selectw -t:21

# titles and bell
set -g set-titles on
set -g set-titles-string "tmux.#I.#W.#T"
set -g bell-action none
set -g visual-activity off

set -g visual-bell off

setw -g monitor-activity off

# Vim-like keybinds
set -g status-keys vi

# Mouse selects panes
set -g mouse-select-pane off
setw -g mode-mouse off

# agressive resize mode
setw -g aggressive-resize on

# utf8 mode
setw -g utf8 on

# Set status bar and theme
set -g display-time 2000
set -g history-limit 32768

set -g status-bg black
set -g status-fg white
set -g status-justify centre
set -g status-left "[#[fg=green] #H #[default]]"
set -g status-left-length 30
set -g status-right "[ #[fg=white]#(cat /proc/loadavg | cut -d \" \" -f 1,2,3)#[default] ][ #[fg=white,bright]%a %Y-%m-%d %H:%M #[default]]"
set -g status-right-length 50
set -g status-keys vi
set -g status-utf8 on

setw -g window-status-current-bg green
setw -g window-status-current-fg black
setw -g window-status-bell-fg red

set -g message-fg black
set -g message-bg green

set -g pane-active-border-fg green
set -g pane-active-border-bg black
set -g pane-border-fg white
set -g pane-border-bg black

# needs testing
# desktop: temp month/day hour:minute
#set -g status-right '#(sensors -A acpitz-virtual-0 | grep temp | cut -d+ -f2 | cut -d. -f1)C %m/%d %H:%M'
# laptop: bat% (battime) temp speed month/day hour:minute
#set -g status-right '#(acpi | cut -d" " -f4,5 | sed "s/, \\(.*\\\)/\\/\\1/g") #(acpi -t | cut -d" " -f4 | cut -d"." -f1)C #(cpufreq-info -mf | sed "s/[ Hz]//g") %m/%d %H:%M'