# Enable alternate screen support in virtual terminals, just like in xterm. altscreen on # don't display the copyright page startup_message off nethack on deflogin on vbell off msgwait 2 defscrollback 3000 term screen-256color # == Command bindings == # -- from RedHat -- bind = resize = bind + resize +1 bind - resize -1 bind _ resize max # (Note: "bind -" overrides the default binding that switches to the internal blank window) # "bind =" overrides the default binding for 'removebuf' # -- from Debian -- # An example of a "screen scraper" which will launch urlview on the current # screen window # ## bind ^B eval "hardcopy_append off" "hardcopy -h $HOME/.screen-urlview" "screen urlview $HOME/.screen-urlview" # == Keybindings == # alt left-arrow key bindkey ^[[1;3D prev # alt right-arrow key bindkey ^[[1;3C next # Clear scrollback and screen of the current window. Finally, presses Ctrl-C # for you, which abandons whatever was typed at the previous prompt and gives # you a new one bind ~ eval "clear" "scrollback 0" "scrollback 3000" "stuff \03" # == backticks == # Generates equivalent of $STY followed by "on $HOST" if $STY is non-standard. # (Checks only the first word of $HOST, in case it's a FQDN.) # TO-DO: chop out the ".pts-NN" backtick 10 60 60 sh -c 'sty=$(screen -ls | grep --color=no -o "$PPID[^[:space:]]*") ; if [ ${sty##*.} = ${HOST%%.*} ] ; then echo $sty ; else echo "$sty on ${HOST%%.*}" ; fi' # == hardstatus == hardstatus on # Derived from Red Hat's normal status line. # includes session name thanks to backtick 10 hardstatus string "[screen %n%?: %t%? (%10`)] %h" # %P doesn't work ## hardstatus string "[screen %n%?: %t%? (%10`)%?%P *** Hacker's treasure zoo ***%?] %h" # %S is session name on version 4.1.0 (squeeze has v4.0.3) ## hardstatus string "[screen %n%?: %t%? (%S)] %h" # %f is supposed to show flags of the window, but doesn't work on squeeze ## hardstatus string "[screen %n%?: %t%? (%f) on %H] %h" # set every new window's hardstatus line to somenthing descriptive # defhstatus "screen: ^En (^Et)" # advertise hardstatus support to $TERMCAP ## termcapinfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\' # combo of Debian and RedHat: don't have "screen" in dis_status_line # (like RedHat does) but do use just the window title (not the icon). # Set the hardstatus prop on gui terms to set the titlebar/icon title termcapinfo xterm*|rxvt*|kterm*|Eterm* hs:ts=\E]2;:fs=\007:ds=\E]2;\007 # -- from Debian -- ## # Set the hardstatus prop on gui terms to set the titlebar/icon title ## termcapinfo xterm*|rxvt*|kterm*|Eterm* hs:ts=\E]0;:fs=\007:ds=\E]0;\007 # An alternative hardstatus to display a bar at the bottom listing the # windownames and highlighting the current windowname in blue. (This is only # enabled if there is no hardstatus setting for your terminal) # ## hardstatus lastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<" # == Default windows == # -- from Debian -- # Example of automatically running some programs in windows on screen startup. # # The following will open top in the first window, an ssh session to monkey # in the next window, and then open mutt and tail in windows 8 and 9 # respectively. # # screen top # screen -t monkey ssh monkey # screen -t mail 8 mutt # -- from RedHat -- # screen -t local 0 # screen -t mail 1 mutt # screen -t 40 2 rlogin server # == Terminfo == # -- Change the xterm initialization string -- # The one on line 80 of Debian's /etc/screenrc is broken; # see [default] in without section below. # Not Debian's fault: this was taken from upstream, credited to "jw" # (See RedHat's /etc/screenrc on line 80.) # # with: # + Set Scrolling Region (DECSTBM) [jw] # + default colours [jw] [jw] # + DEC Private Mode Set (DECSET): # - Wraparound Mode (DECAWM) [jw] # + DEC Private Mode Reset (DECRST): # - Normal Cursor Keys (DECCKM) # - Jump (Fast) Scroll (DECSCLM) [jw, default] # - Numeric keypad (DECNKM) # + Reset Mode (RM): # - Replace Mode (IRM) # without: # + Soft terminal reset (DECSTR) [default] -- screws up altscreen on screen v4.0.3-14 # + Erase in Display (ED): Erase All [jw] # + Cursor Position [1,1] (CUP) [jw] # + DEC Private Mode Reset (DECRST): # - 80 Column Mode (DECCOLM) [default] # - Normal Cursor Mode (DECOM) -- this causes cursor reposition to [1,1] on screen v4.1 # + Normal Keypad (DECPNM) [default] termcapinfo xterm is=\E[r\E[m\E[?7h\E[?1;4;66l\E[4l # terminfo default: ## termcapinfo xterm is=\E[!p\E[?3;4l\E[4l\E> # jw, i.e. Debian: ## termcapinfo xterm is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l # -- from RedHat -- # Make the output buffer large for (fast) xterms. #termcapinfo xterm* OL=10000 termcapinfo xterm* OL=100 # Capabilities: # G0 we have a SEMI-GRAPHICS-CHARACTER-MODE # WS this sequence resizes our window. # cs this sequence changes the scrollregion # hs@ we have no hardware statusline. screen will only believe that # there is a hardware status line if hs,ts,fs,ds are all set. # ts to statusline # fs from statusline # ds delete statusline # al add one line # AL add multiple lines # dl delete one line # DL delete multiple lines # ic insert one char (space) # IC insert multiple chars # nx terminal uses xon/xoff # emulate part of the 'K' charset # (this aapears to be a non-standard termcap sequence; see # https://www.gnu.org/software/screen/manual/html_node/Termcap.html ) termcapinfo xterm* 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337' ## # xterm-52 tweaks: ## # - uses background color for delete operations ## termcapinfo xterm* be # terminal emulation of screen supports multiple character sets termcapinfo facit|vt100|xterm* G0 # the vt100 description does not mention "dl". *sigh* termcapinfo vt100 dl=5\E[M # Extend the vt100 desciption by some sequences. termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC # Terminal needs bold to display high-intensity colors termcapinfo linux|Eterm C8 # Do not use xterms alternate window buffer. # This one would not add lines to the scrollback buffer. ## termcapinfo xterm|xterms|xs ti=\E7\E[?47l # -- from Debian -- # set these terminals up to be 'optimal' instead of vt100 termcapinfo xterm*|linux*|rxvt*|Eterm* OP # == Other Stuff == # -- from RedHat -- # emulate .logout message pow_detach_msg "Screen session of $LOGNAME $:cr:$:nl:ended." # make the shell in every window a login shell ## shell -$SHELL # This is how one can set a reattach password: ## password ODSJQf.4IJN7E # "1234" ## blankerprg rain -d 100 ## idle 30 blanker ## caption always "%3n %t%? @%u%?%? [%h]%?%=%c" # alternative caption, gives window list, LOGNAME and current date: ## caption always "%{wk}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{wk}%?%+Lw %=%{mk}@%H %{yk}%D %{ck}%M%{wk} %{ck}%d %{gk}%c" # == Stuff missing from RedHat's /etc/screenrc == # To get screen to add lines to xterm's scrollback buffer, uncomment the # following termcapinfo line which tells xterm to use the normal screen buffer # (which has scrollback), not the alternate screen buffer. # ## termcapinfo xterm*|xterms|xs|rxvt ti@:te@ # Enable non-blocking mode to better cope with flaky ssh connections. defnonblock 5 # -- from http://web.mit.edu/barnowl/etc/screenrc-4.0.3 -- # 256 COLOR SUPPORT (--asedeno) # ... http://frexx.de/xterm-256-notes/ # use bright colors for bold text attrcolor b ".I" # tell screen how to set colors. AB = background, AF=foreground # (This is unnecessary if $TERM is set properly) # Pass codes into the window. # (This won't work because things don't use $TERMCAP any more) ## termcapinfo xterm-256color "" 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' # erase background with current bg color # Warning: causes TERM=screen-bce ## defbce "on"