# Phil!'s .screenrc
# Easier than remembering to always run from non-X
unsetenv DISPLAY
# Likewise, for charset
setenv LC_CTYPE en_US.UTF-8
# Add stuff to xterm (and cousins) title bars. This is a moderate abuse of the
# hardstatus feature--it just puts the hardstatus stuff into an xterm title
# bar.
termcapinfo xterm*|Eterm|mlterm 'hs:ts=\E]0;:fs=\007:ds=\E]0;screen\007'
defhstatus "screen (t) | $USER@H"
hardstatus off
# 256 color xterm
attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
defbce "on"
# Fix broken termcap for my 3151 so bold text is closed properly. Also
# translate from ISO-8859-1 into the CP437 that the terminal displays.
termcapinfo ibm3151 me=\E4@
termcapinfo ibm3151 XC=B%,\307\200,\374\201,\351\202,\342\203,\344\204,\340\205,\345\206,\347\207,\352\210,\353\211,\350\212,\357\213,\356\214,\354\215,\304\216,\305\217,\311\220,\346\221,\306\222,\364\223,\366\224,\362\225,\373\226,\371\227,\377\230,\326\231,\334\232,\242\233,\243\234,\245\235,\341\240,\355\241,\363\242,\372\243,\361\244,\321\245,\252\246,\272\247,\277\250,\254\252,\275\253,\274\254,\241\255,\253\256,\273\257,\337\341,\265\346,\261\361,\367\366,\260\370,\267\372,\262\375,\240\377,\244?,\246?,\247?,\250?,\251?,\255?,\256?,\257?,\263?,\264?,\266?,\270?,\271?,\276?,\300?,\301?,\302?,\303?,\310?,\312?,\313?,\314?,\315?,\316?,\317?,\320?,\322?,\323?,\324?,\325?,\327?,\330?,\331?,\332?,\333?,\335?,\336?,\343?,\360?,\365?,\370?,\375?,\376?
# Give me some info at the bottom of the screen. Since hardstatus is in use by
# the above xterm title hack, the only source of information left is the
# caption that normally only gets displayed if you have split windows.
# e.g.:
# 11:50|Mon|Jan 06|aragorn f 3$ mutt 4$ centericq 5$* less 6-&!$ man 7$ xe
# (Current window is in reverse bold.)
# See bottom of file for more complete description.
caption always "%?%F%{-b bc}%:%{-b bb}%?%C|%D|%M %d|%H%?%F%{+u wb}%? %L=%-Lw%45>%{+b by}%n%f* %t%{-}%+Lw%-0<"
# Make screen messages stand out a little more - black on bright green.
sorendition "+b kG"
# Variants on Sven's custom messages.
activity "%c activity -> %n%f %t"
bell "%c bell -> %n%f %t^G"
vbell_msg " *beep* "
# I know about screen. I don't need to see it every time I start the program.
# (Which is, admittedly, rarely.)
startup_message off
# Log new screen windows in utmp.
deflogin on
# Never, ever turn this off.
autodetach on
# Just in case it isn't clear...
shell zsh
# I like to hear the beep.
vbell off
# And show the command for the windows when they're resurrected.
verbose on
# Escape key is C-z. (I use C-a too much in Emacs.)
defscrollback 5000
# Run everything in UTF-8.
defutf8 on
# If a window goes unresponsive, don't block the whole session waiting for it.
nonblock on
# Use the function keys to switch among windows.
bindkey -k k1 select 0
bindkey -k k2 select 1
bindkey -k k3 select 2
bindkey -k k4 select 3
bindkey -k k5 select 4
bindkey -k k6 select 5
bindkey -k k7 select 6
bindkey -k k8 select 7
bindkey -k k9 select 8
bindkey -k k; select 9
bindkey -k F1 select 10
bindkey -k F2 select 11
# windows 13-24 are Shift-Fn. May not work in all terminals.
bindkey -k F3 select 12
bindkey -k F4 select 13
bindkey -k F5 select 14
bindkey -k F6 select 15
bindkey -k F7 select 16
bindkey -k F8 select 17
bindkey -k F9 select 18
bindkey -k FA select 19
# screen only seems to understand up to FA.
#bindkey -k FB select 21
#bindkey -k FC select 22
#bindkey -k FD select 23
#bindkey -k FE select 24
# select works on window names, too. This gives me the first window with a
# free shell.
bind s select zsh
# Make shift-PgUp and shift-PgDn work like they do in xterm. (Note that this
# requires xterm to be configured to pass those keys through, and not try to
# act on them itself.)
bindkey "^[[5;2~" eval "copy" "stuff ^u"
bindkey -m "^[[5;2~" stuff ^u
bindkey -m "^[[6;2~" stuff ^d
# Window numbering starts at 1, not 0.
bind c screen 1
bind 0 select 10
# Login toggle is too close to screen redraw. How about explicitly setting
# login state, anyway?
bind 'L'
bind 'I' login on
bind 'O' login off
# It's sometimes useful to have a quote key.
bind ^Q mapdefault
bind q mapdefault
# And since that leaxes xon unbound, let's remove xoff, too.
bind ^S
# Using tab to move around regions gets annoying. These help.
bind ^j focus down
bind ^k focus up
bind ^t focus top
bind ^b focus bottom
# More fixes for the IBM 3151. Force the terminal's backspace (^H) to generate
# the required ^?. (This renders ^H unusable for help from the terminal.)
bindkey -k kb stuff "\177"
# This lets me use specific commands from screen escape sequences.
multiuser on
aclchg :window: +x select
#source ${HOME}/.screenrc-${HOST}
# caption description:
# caption always "%?%F%{-b bc}%:%{-b bb}%?%C|%D|%M %d|%H%?%F%{+u wb}%? %L=%-Lw%45>%{+b by}%n%f* %t%{-}%+Lw%-0<"
#
# Anything I don't describe is treated literally.
#
# %? - Start of a conditional statement.
# %F - Use this part of the statement if the window has focus (i.e. it
# is the only window or the currently active one).
# %{-b bc} - Turn off bold, blue foreground, cyan background.
# %: - else
# %{-b bb} - Turn off bold, blue foreground, blue background (this obscures
# the text on non-focused windows and just gives a blue line).
# %? - End conditional statement.
# %C - time (hh:mm, leading space) in 12 hour format
# %D - Three-letter day-of-week appreviation
# %M - Three-letter month appreviation
# %d - Day of the month
# %H - hostname
# %? - Start of conditional statement.
# %F - Use this part of the statement if the window has focus.
# %{+u wb} - underlined, white foreground, blue background
# %? - End conditional (if not focused, text remaind blue on blue).
# %L= - truncation/padding point. With the 'L' qualifier, basically
# just acts as a reference point. Further truncation/padding is
# done relative to here, not the beginning of the string
# %-Lw - window list up to but not including the current window (-),
# show window flags (L)
# %45> - truncation/padding marker; place this point about 45% of the
# way into the display area (45)
# %{+b by} - add bold (still underlined from before), blue foreground,
# yellow background
# %n - number of the current window
# %f - flags for current window
# %t - title of current window
# %{-} - undo last color change (so now we're back to underlined white
# on blue) (technically, this is a pop; a second invocation
# would drop things back to unadorned blue on cyan)
# %+Lw - window list from the next window on (-), show window flags (L)
# %-0< - truncation/padding point. Place this point zero spaces (0)
# from the right margin (-).