Skip to content

Instantly share code, notes, and snippets.

@jart
Last active April 15, 2018 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jart/2ac6cbd4558fecece9f094e436632bdf to your computer and use it in GitHub Desktop.
Save jart/2ac6cbd4558fecece9f094e436632bdf to your computer and use it in GitHub Desktop.
Justine's GNU Screen Configuration
# -*- conf -*-
## GNU Screen Configuration
## Justine Tunney <jart@google.com>
# GNU Screen + this config allow you to:
#
# - Have tabs inside your terminal.
#
# - Have your terminal sessions persist, even if you close your ssh connection.
# This is especially great if you hop between multiple computers or simply
# don't want to lose what you're working on.
#
# - Allow multiple clients (or humans) to view and edit the same terminal
# session simultaneously (sort of like remote desktop).
#
# This config has been battle tested across many platforms, terminal programs,
# and operating systems. It supports 256-color and doesn't screw anything up.
# It displays a pretty status bar at the bottom of your terminal so you can
# keep track of where you are. It's just awesome, ok?
################################################################################
## GETTING STARTED
# Shell Commands:
#
# screen -axARRS jart <- Open screen session named 'jart' in sharing mode.
# screen -aDARRS jart <- Open screen session named 'jart' in thief mode.
#
# Shortcuts (they all start with backtic: `)
#
# ` `: Type a normal backtic (by pressing it twice)
# ` d: Detach and exit screen (screen -DR brings it back)
# ` n: Go to Next tab
# ` p: Go to Previous tab
# ` k: Kill current tab
# ` A: Change title of current tab
# ` F: Force current tab to fit your terminal size in multiuser mode.
# ` [: Freezes screen so you can use the arrow keys to scroll around and
# look for information. Press '?' to start searching backwards
# and `/` to search forward (vi shortcuts). You can also use the
# scroll wheel. Press <enter> a bunch of times to exit this mode.
################################################################################
## GENERAL CONFIGURATION
escape `` # this makes back-tic (under tilde) the magic key
# escape ^x^x # uncomment me if you'd prefer C-x
# escape ^a^a # C-a is actually the default. What were they thinking?
autodetach on
vbell on
vbell_msg "YOU HAVE NO CHANCE TO SURVIVE MAKE YOUR TIME"
startup_message off
shelltitle "$|bash"
setenv LC_CTYPE en_US.UTF-8
encoding UTF-8
defutf8 on
nonblock on
bind ^w windowlist -m
bind w windowlist -m
bind ^n next
bind n next
bind ^h prev
bind h prev
bind ^t focus
bind t focus
bind ^r title
bind ^m colon
bind 0 remove
bind 1 only
bind 2 split
bind = resize =
bind + resize +3
bind - resize -3
# backtick 1 60 60 /usr/local/google/home/jart/bin/mtgox
# %1` BTC/USD |
caption always "%{= mw}%-w%{= Mk}%50>%n %t%{-}%+w%< %=%{= Bk}%H | %l | %D %C %a"
# caption always "%{= bw}%-w%{= Bk}%50>%n %t%{-}%+w%< %=%{= Mk}%H | %l | %D %C %a"
# caption always "%{= KW}%-w%{= wk}%50>%n %t%{-}%+w%< %=[%H | %l | %D %C %a]"
hardstatus off
################################################################################
## AUTO TABS
screen -T xterm-256color -t emacs 0 emacs -nw
screen -T xterm-256color -t bash 1
screen -T xterm-256color -t htop 10 htop
select 1
#acladd drew # Allow drew to view this screen session
#############################################################################
## XTERM TWEAKS
# 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
# 80/132 column switching must be enabled for ^AW to work
# change init sequence to not switch width
termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l
#defscrollback 5000
# Make the output buffer large for (fast) xterms.
termcapinfo xterm OL=10000
# tell screen that xterm can switch to dark background and has function keys.
termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l'
termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~'
termcapinfo xterm 'kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:kP=\E[H:kN=\E[6~'
# special xterm hardstatus: use the window title.
termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]0;screen\007'
# our xterm has colors! (rxvt, too)
termcap xterm 'AF=\E[3%dm:AB=\E[4%dm'
terminfo xterm 'AF=\E[3%p1%dm:AB=\E[4%p1%dm'
#terminfo xterm 'vb=\E[?5h$<200/>\E[?5l'
termcapinfo xterm 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l'
# emulate part of the 'K' charset
termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337'
# support 256-color mode.
attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
defbce "on"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment