Skip to content

Instantly share code, notes, and snippets.

@evil5hadow
Last active August 28, 2018 13:19
Show Gist options
  • Save evil5hadow/c795f26f388c199f1642cf31dabf3b37 to your computer and use it in GitHub Desktop.
Save evil5hadow/c795f26f388c199f1642cf31dabf3b37 to your computer and use it in GitHub Desktop.
.screenrc_20180828
# Updated: 2018.08.28
# CTRL + ← or → move to next/previous screen window
# SHIFT + ← or → move to next/previous terminator window
#
# C-a :sessionname
#
### screen as an answering machine!
#
# no annoying audible bell, please
vbell on
vbell_msg "Hey - something's ringing on %t (%n)"
activity "Hey - something's moving in %t(%n)"
# better vi - check me
#altscreen on
### colors
#
# some notes on COLOR before explaining its use in
# the commands caption, hardstatus, and sorendition.
#
# COLOR: colors codes are combinations of
# [attribute modifier] [color description]
# the manual talks of "attribute/color modifiers".
# see the manual, section "STRING ESCAPES".
#
# Color table:
# 0 Black . leave color unchanged
# 1 Red b blue
# 2 Green c cyan
# 3 Brown / yellow d default color
# 4 Blue g green b bold
# 5 Purple k blacK B blinking
# 6 Cyan m magenta d dim
# 7 White r red r reverse
# 8 unused/illegal w white s standout
# 9 transparent y yellow u underline
#
#the caption line - screen status bar!
#
# %{= bb}%{+b w} colors
# %t window name
# %= end of line
# %Y-%m-%d year-month-date
# %c clock
#
### the hardstatus line - verbose screen menu!
#
#defhstatus "screen ^E (^Et) | $PWD@^EH"
hardstatus alwayslastline "%{kk}%{.bw}[%H][%S]%{-} %{g}%-w%{.yk}%n%t%{-}%+w %= %{-} %{= g} %{rw}%l%?%{kg} [%Y-%m-%d %c]"
################
#
# Tweaks
#
# number of lines in buffer
#
defscrollback 50000
setenv LC_CTYPE en_US.UTF-8
# Always start `screen` with UTF-8 enabled (`screen -U`)
defutf8 on
defencoding UTF-8
#attrcolor u "-u b"
#attrcolor b "R"
# make the shell in every window a login shell
# use the login shell
shell -$SHELL
# default name for new windows
# search | name for dynamic window titles
shelltitle '$ | bash'
chdir $HOME
### logging in/off
#
# don't display the copyright page
startup_message off
# Don't block command output if the terminal stops responding
# (like if the ssh connection times out for example).
nonblock on
# emulate .logout message
pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended."
# don't kill window after the process died
# zombie "^["
### detaching/reattaching
#
# detach on hangup
autodetach on
# This is how one can set a reattach password:
#password redacted
# disable password with ctrl+a :password none
#########
#
# keybindings
#
# The "bind" command assign keys to (internal) commands
# SCREEN checks all the keys you type; you type the key
# which is known as the "command character" then SCREEN
# eats this key, too, and checks whether this key is
# "bound" to a command. If so then SCREEN will execute it.
#
# The command "bind" allows you to chose which keys
# will be assigned to the commands.
#
# Some commands are bound to several keys -
# usually to both some letter and its corresponding
# control key combination, eg the command
# "(create) screen" is bound to both 'c' and '^C'.
#
# The following list shows the default bindings:
#
# break ^B b
# clear C
# colon :
# copy ^[ [
# detach ^D d
# digraph ^V
# displays *
# dumptermcap .
# fit F
# flow ^F f
# focus ^I
# hardcopy h
# help ?
# history { }
# info i
# kill K k
# lastmsg ^M m
# license ,
# log H
# login L
# meta x
# monitor M
# next ^@ ^N sp n
# number N
# only Q
# other ^X
# pow_break B
# pow_detach D
# prev ^H ^P p ^?
# quit \
# readbuf <
# redisplay ^L l
# remove X
# removebuf =
# reset Z
# screen ^C c
# select " '
# silence _
# split S
# suspend ^Z z
# time ^T t
# title A
# vbell ^G
# version v
# width W
# windows ^W w
# wrap ^R r
# writebuf >
# xoff ^S s
# xon ^Q q
# ^] paste .
# - select -
# 0 select 0
# 1 select 1
# 2 select 2
# 3 select 3
# 4 select 4
# 5 select 5
# 6 select 6
# 7 select 7
# 8 select 8
# 9 select 9
# I login on
# O login off
# ] paste .
#
# And here are the default bind commands if you need them:
#
# bind A title
# bind C clear
# bind D pow_detach
# bind F fit
# bind H log
# bind I login on
# bind K kill
# bind L login
# bind M monitor
# bind N number
# bind O login off
# bind Q only
# bind S split
# bind W width
# bind X remove
# bind Z reset
# Let's remove some dangerous key bindings ...
bind k
bind ^k
# bind . dumptermcap # default
bind .
bind ^\
bind \\
# bind ^h ??? # default
bind ^h
bind h hardcopy # default
# bind h
bind / quit
bind ^/ quit
# ... and make them better.
bind 'K' kill
bind 'I' login on
bind 'O' login off
bind '}' history
# Yet another hack:
# Prepend/append register [/] to the paste if ^a^] is pressed.
# This lets me have autoindent mode in vi.
register [ "\033:se noai\015a"
register ] "\033:se ai\015a"
bind ^] paste [.]
# Arrow keys to switch terminals (only works with X)
# Alt + left
#bindkey ^[[1;3D prev
# Alt + right
#bindkey ^[[1;3C next
bindkey "^[[1;5C" next # Ctrl-Right
bindkey "^[[1;5D" prev # Ctrl-Left
bindkey "^p" prev # Ctrl-p
bindkey "^n" next # Ctrl-n
bindkey "^[k" eval "copy" "stuff ^b" # enter copy mode and move up one page
bindkey "^k" eval "copy" "stuff k" # enter copy mode and move up one line
bindkey -m "^[k" stuff ^b # Alt+Meta move up one page
bindkey -m "^k" stuff k # move up one line
# Scroll up & down with CTRL + PageUP & PageDown
#bindkey ^[[5;5~ eval "copy" "stuff ^U"
#bindkey ^[[6;5~ eval "copy" "stuff ^D"
bindkey ^[1;5A~ eval "copy" "stuff ^U"
bindkey ^[1;5B~ eval "copy" "stuff ^D"
# Resize the current region. The space will be removed from or added to
# the region below or if there's not enough space from the region above.
bind = resize =
bind + resize +3
bind - resize -3
# bind _ resize max
#
# attrcolor u "-u b"
# attrcolor b "R"
# make split, tab, last window one keystroke
bind S eval split focus other
# remap the escape key
#escape ``
#defescape ``
# open a new shell with `c
#bind c screen
# rename screen window with Ctrl-A + r
bind r title
# Display session name (disabled because it's included in hardstatus)
#bind s sessionname
# Set the environment variable var to value string. If only var is specified,
# you'll be prompted to enter a value. If no parameters are specified,
# you'll be prompted for both variable and value. The environment is
# inherited by all subsequently forked shells.
setenv PROMPT_COMMAND 'echo -n -e "\033k\033\134"'
# default window
screen -t "d(o.0)b" 0
# Don't you want to start programs which need a DISPLAY ?
setenv DISPLAY ':0'
################
#
# 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
# Make the output buffer large for (fast) xterms.
#termcapinfo xterm* OL=10000
termcapinfo xterm* OL=100
# 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=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~'
# special xterm hardstatus: use the window title.
termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
#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'
# Enable mouse scrolling and scroll bar history scrolling
termcapinfo xterm* ti@:te@
# Change the xterm initialization string from is2=\E[!p\E[?3;4l\E[4l\E>
# (This fixes the "Aborted because of window size change" konsole symptoms found
# in bug #134198)
termcapinfo xterm* 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
# xterm-52 tweaks:
# - uses background color for delete operations
termcapinfo xterm* be
################
#
# wyse terminals
#
#wyse-75-42 must have flow control (xo = "terminal uses xon/xoff")
#essential to have it here, as this is a slow terminal.
termcapinfo wy75-42 xo:hs@
# New termcap sequences for cursor application mode.
termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J
################
#
# other terminals
#
# make hp700 termcap/info better
termcapinfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@'
# 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
termcapinfo linux C8
# old rxvt versions also need this
# termcapinfo rxvt C8
### misc
#
# advertise hardstatus support to $TERMCAP
termcapinfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment