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



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

# v1.5 - 2015-05-27: modification of caption bar because of bad support of accentuated characters
# v1.4 - 2015-03-01: scrollback value increased / date field modified in hardstatus due to size problem in month short name between French and English
# v1.3 - 2014-09-30: new key binding for moving between screens when in intricate screen session
# v1.2 - 2014-09-02: correction of a minor bug on key binding for renaming
# v1.1 - 2014-08-21: clean up / reading of .screen_profile added
# 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

# Wheel used as moving cursor
#termcapinfo xterm* ti@:te@


#-------------------#
# Visual parameters #
#-------------------#

# Visual bell
vbell off

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

# Define a bigger scrollback, default is 100 lines
defscrollback 10000

# Caption bar
#caption always "%{kw}%3n %t%? @%u%?%? [%h]%?"
caption always "%{kw}%3n %t%? @%u%?%?"

# Hardstatus bar
hardstatus on
hardstatus alwayslastline "%{= G}[ %{G}%H %{G}][%L=%{w}%=%-Lw%50L>%{wk}%n*%f%t%{dw}%+Lw %=%-21=%{G}][%{B} %Y-%m-%d %{W}%c %{G}]"



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

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


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

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

bindkey -k k1 focus top     # F1: move to the top region
bindkey -k k2 focus bottom  # F2: move to the bottom region
bindkey -k k3 eval "clear" "focus up" "clear" "focus up"    # F3: clear both regions


# Window management
bindkey -k k4 quit          # F4: close all windows and exit screen
bindkey -k k5 windowlist    # F5: windowlist
bindkey -k F2 title         # F12: rename window

bindkey "^[[6;5~" next      # Ctrl-pgup: move to the next window
bindkey "^[[5;5~" prev      # Ctrl-pgdown: move to the previous window
bind p next     # C-x (x)  p: move to the next window
bind o prev     # C-x (x) o: move to the previous window

bindkey "^[[6;3~" number +1 # Alt-pgup: move tab up (increase tab number)
bindkey "^[[5;3~" number -1 # Alt-pgdown: move tab down (decrease tab number)


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



#==================#
# Specific profile #
#==================#

source "$HOME/.screen_profile"
