# the following two lines give a two-line status, with the current window highlighted
hardstatus alwayslastline
hardstatus string '%{= dg}[%{C}%H%{Y}/%{C}%1`%{g}][%= %{= dw}%-w%{.m} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{R}%d/%m %{Y}%C%A%{g}]'

# backticks command
backtick 1 0 0 echo $USER

# huge scrollback buffer
defscrollback 5000

# no welcome message
startup_message off

# 256 colors
attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
defbce on

# mouse tracking allows to switch region focus by clicking
mousetrack on

# layout options
layout autosave on
layout default
layout save default


# default windows
screen -t Shell 1

# window numbering starts at 1 not 0
bind c screen -t Shell 1

# ^a-0 select 10
bind 0 select 10

# get rid of silly xoff stuff
bind s split

# scroll test
bindkey -d "^[[5S" screen

# ^a-R rename shell title
bind "R" title

# ^a-s split vertically and ^a-S split horizontally
bind "s" eval "split -v" "focus"
bind "S" eval "split" "focus"

# ² switch to next shell
bindkey ² next

# ^a-x close current region
bind "x" remove

# ^a-= reset regions size
bind "=" resize =

# navigating regions with Ctrl-arrows
bindkey "^[[1;5D" focus left
bindkey "^[[1;5C" focus right
bindkey "^[[1;5A" focus up
bindkey "^[[1;5B" focus down

# ^a-r puts Screen into resize mode. Resize regions using hjkl or qzsd keys.
bind 'r' eval "command -c rsz" # enter resize mode

# use hjkl keys to resize regions
bind -c rsz h eval "resize -h -5" "command -c rsz"
bind -c rsz j eval "resize -v -5" "command -c rsz"
bind -c rsz k eval "resize -v +5" "command -c rsz"
bind -c rsz l eval "resize -h +5" "command -c rsz"
# use zqsd keys to resize regions
bind -c rsz q eval "resize -h -1" "command -c rsz"
bind -c rsz z eval "resize -v -1" "command -c rsz"
bind -c rsz s eval "resize -v +1" "command -c rsz"
bind -c rsz d eval "resize -h +1" "command -c rsz"

# quickly switch between regions using tab and arrows
bind -c rsz \t    eval "focus"       "command -c rsz" # Tab
bind -c rsz -k kl eval "focus left"  "command -c rsz" # Left
bind -c rsz -k kr eval "focus right" "command -c rsz" # Right
bind -c rsz -k ku eval "focus up"    "command -c rsz" # Up
bind -c rsz -k kd eval "focus down"  "command -c rsz" # Down
