# Title: .screenrc
# Author: Frédéric CHEVALIER <f15.chevalier@gmail.com>
# Version: 1.0
# Created in: 2014-08-11
# Modified in: 2014-08-12



#==========#
# Versions #
#==========#

# v1.0 - 2014-08-12: huge improvement from informations get on the Internet
# v0.0 - 2014-08-11: creation


#==================#
# General Settings #
#==================#

# Startup message
startup_message off

# use login shell
shell -${SHELL}

# utf-8
defutf8 on

# Terminal to use
term xterm

# Visual bell
vbell off

# Clean screen after program usage (man, vi, etc.)
altscreen on



# Show where I am
#caption always
#caption always "%n(%t)"
caption always "%{kw}%3n %t%? @%u%?%? [%h]%?"


# modded from billnye's .screenrc
hardstatus on
##hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} "
#####hardstatus alwayslastline "%{= G}[ %{G}%H %{G}][%L=%=%{= w} %-Lw %50L>%{wk} %n*%f%t %{dw} %+Lw%= %-20=%{G}][%{B} %d %M %y %{W}%c %{G}]"
hardstatus alwayslastline "%{= G}[ %{G}%H %{G}][%L=%{w}%=%-Lw%50L>%{wk}%n*%f%t%{dw}%+Lw %=%-20=%{G}][%{B} %d %M %y %{W}%c %{G}]"
#hardstatus alwayslastline "%{= G}[ %{G}%H %{G}][%L=%{w}%=%-Lw%{wk}%n%f*%t%{dw}%+Lw %=%-20=%{G}][%{B} %d %M %y %{W}%c %{G}]"
#hardstatus  alwayslastline "%-w%{= BW}%50>%n %t%{-}%+w%<"
#hardstatus alwayslastline '%{= Kd} %{= Kd}%-w%{= Kr}[%{= KW}%n %t%{= Kr}]%{= Kd}%+w %-= %{KG} %H%{KW}|%{KY}%101`%{KW}|%D %M %d %Y%{= Kc} %C%A%{-}'
#hardstatus alwayslastline '%{= kG}[ %{G}%H %{G}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{G}][%{B} %d %M %y %{W}%c %{G}]'
#hardstatus alwayslastline '%{= kG}[ %{G}%H %{G}][%= %{= kw}%?%-Lw%?%{b}%n*%f %t%?(%u)%{w}%?%+Lw%?%?%= %{G}][%{B} %d %M %y %{W}%c %{G}]'
#hardstatus alwayslastline '%{= kG}[ %{G}%H %{G}][%= %?%-Lw%{= BW}%50%n%f* %t%{-}%?%%+Lw%= %{G}][%{B} %d %M %y %{W}%c %{G}]'
#hardstatus alwayslastline '%{= kG}[ %{G}%H %{G}][%= %-Lw%{= BW}%50>%n%f* %t%{-}%?%+Lw%?<%?%= %{G}]'
#hardstatus alwayslastline "%{rw}%H%{wk}|%?%-Lw%?%{wb}%n*%f %t%?(%u)%?%{wk}%?%+Lw%?"



#hardstatus alwayslastline "%{bw}[%{Y}%h%011=%{-}]%+01=%{Kw} %-w%50L>%{yk}%{Y.}%n%{-} %t%{-}%+w %-012=%{y} %m/%d %c"


# xterm understands both im/ic and doesn't have a status line.
# Note: Do not specify im and ic in the real termcap/info file as
# some programs (e.g. vi) will not work anymore.
#termcap xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l
#terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l


#termcapinfo cygwin|xterm* 'hs:ts=\E]0;:fs=\007:ds=\E]0;\007'
# Wheel used as moving cursor
#termcapinfo xterm* ti@:te@
#termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'

# Resizing
#termcapinfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'



#=============#
# Key binding #
#=============#

# Escape/command character change to Ctrl-x (instead of Ctrl-a)
escape ^Xx


# Ctrl-up, Ctrl-down to move between regions
bindkey "^[[1;5A" focus up
bindkey "^[[1;5B" focus down

# Ctrl-pgup, Ctrl-pgdown to move between windows
bindkey "^[[6;5~" next
bindkey "^[[5;5~" prev
#bindkey "^[[1;5C" next
#bindkey "^[[1;5D" prev

# Alt-pgup, Alt-pgdown to move window numbers
bindkey "^[[6;3~" number +1
bindkey "^[[5;3~" number -1

# F9, F10, F11 to decrease, increase, equalize region size
bindkey "^[[20~" resize -1
bindkey "^[[21~" resize +1
bindkey "^[[23~" resize =

# F1, F2 to move to top/bottom region
# F3 to clear both regions
# F4 to close all windows and exit screen
bindkey -k k1 focus top
bindkey -k k2 focus bottom
bindkey -k k3 eval "clear" "focus up" "clear" "focus up"
bindkey -k k4 quit

# F5 windowlist, #F6 rename window
bindkey -k k5 windowlist
bindkey -k k6 title 

# New window (C-a C-c)
bindkey ^[t stuff "screen -X cd \$PWD; screen^M"
#bind ^c stuff "screen -X chdir \$PWD; screen^M"
#bind ^c stuff "screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

#bind s split