# use the same prefix as dwm
set -g prefix C-g
# needed for e.g. mutt
bind C-g send-prefix

set -g set-titles on
set -g status-position top
set -g status-keys vi
set -g mode-keys vi
set -g base-index 1
set -g pane-base-index 1

set history-file ~/.tmux_SSH_history
set -g history-limit 100000
set -s set-clipboard on
set -g display-time 3000
set -g display-panes-time 3000

set -g pane-border-fg colour240
set -g pane-active-border-fg colour250
set -g pane-border-status top

setw -g window-status-current-bg colour240
setw -g window-status-current-fg colour250
setw -g window-status-separator "|"
set -g status-bg colour235
set -g status-fg colour245

# Use the user option set by script to display the host name,
# set two blanks if there are no flags set for fixed tab width
set -g window-status-format         " #I #{@HOST} #{=-2:?window_flags, #{window_flags},  }"
set -g window-status-current-format " #I #{@HOST} #{=-2:?window_flags, #{window_flags},  }"
CMD="sh ~/.tmux/SSH.sh -r"

# disable!!! 'cause tmux crashes if on and hook is set
set -g renumber-windows off
##############################################################
## if You use a tmux version which not supports hooks run
## the script hidden in the status
#set -g status-right-length 0
#set -g status-right "#($CMD)"
#set -g status-interval 1
##############################################################

##############################################################
# I want to use hooks
set-hook -g 'after-join-pane' 'run "$CMD"'
set-hook -g 'after-move-pane' 'run "$CMD"' 
set-hook -g 'after-break-pane' 'run "$CMD"' 
set-hook -g 'after-select-pane' 'run "$CMD"' 
set-hook -g 'pane-exited' 'run "$CMD"' 
set-hook -g 'after-new-window' 'run "$CMD"' 
set-hook -g 'after-split-window' 'run "$CMD"' 
##############################################################

# I prefer not to have a status for my tabbed term
set -g status-right ""
set -g status-right-length 0
set -g status-left-length 0
set -g status-left ""

bind R source-file ~/.tmux/SSH.conf \; display-message "source-file done"

# some settings for "navigation"
bind -n C-PageUp copy-mode -eu
unbind -n C-Left
unbind -n C-Right
bind -n C-Left  select-window -t :-
bind -n C-Right select-window -t :+

# I prefer a tiled layout and easy joining of current active pane via windows'
# index
bind F1 join-pane -s 1.\; select-layout tiled
bind F2 join-pane -s 2.\; select-layout tiled
bind F3 join-pane -s 3.\; select-layout tiled
bind F4 join-pane -s 4.\; select-layout tiled
bind F5 join-pane -s 5.\; select-layout tiled
bind F6 join-pane -s 6.\; select-layout tiled
bind F7 join-pane -s 7.\; select-layout tiled
bind F8 join-pane -s 8.\; select-layout tiled
bind F9 join-pane -s 9.\; select-layout tiled
