Skip to content

Instantly share code, notes, and snippets.

@zthxxx
Last active November 8, 2023 16:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zthxxx/df7e121048b12c80f260285d88e1091f to your computer and use it in GitHub Desktop.
Save zthxxx/df7e121048b12c80f260285d88e1091f to your computer and use it in GitHub Desktop.
screen preference
# Install
# curl -sL https://gist.github.com/zthxxx/df7e121048b12c80f260285d88e1091f/raw/.screenrc -o ~/.screenrc
# curl -s https://gist.githubusercontent.com/zthxxx/df7e121048b12c80f260285d88e1091f/raw/.screenrc -o ~/.screenrc
# Shortcut Key binding
# https://www.gnu.org/software/screen/manual/screen.html#Bindkey
# remap prefix key `Ctrl-A` to `Ctrl-S`
# https://superuser.com/questions/422126/remap-ctrl-a-in-gnu-screen
escape ^Ss
# bind Alt + [`123...=] to screen 0~12
bindkey "^[`" select 0
bindkey "^[1" select 1
bindkey "^[2" select 2
bindkey "^[3" select 3
bindkey "^[4" select 4
bindkey "^[5" select 5
bindkey "^[6" select 6
bindkey "^[7" select 7
bindkey "^[8" select 8
bindkey "^[9" select 9
bindkey "^[0" select 10
bindkey "^[-" select 11
bindkey "^[=" select 12
# bind F2 to previous window
# bind F3 to next window
# bind F5 to create a new screen
# bind F6 to detach screen session
# bind F7 to kill current screen window
# bind F8 to rename current screen window
bindkey -k k2 prev
bindkey -k k3 next
bindkey -k k5 screen
bindkey -k k6 detach
bindkey -k k7 kill
bindkey -k k8 title
# Config
# set all encoding utf8
# https://www.gnu.org/software/screen/manual/screen.html#Character-Processing
defutf8 on
defencoding utf8
encoding utf8 utf8
# login shell, for trigger `.bashrc`, `.profile`, `/etc/profile` ..
# https://www.gnu.org/software/screen/manual/screen.html#Shell
term linux
shell -$SHELL
startup_message off
# scroll under xterm
# https://www.gnu.org/software/screen/manual/screen.html#Termcap-Syntax
# http://stackoverflow.com/a/1125947
termcapinfo xterm* ti@:te@
# scroll cache
# https://www.gnu.org/software/screen/manual/screen.html#Scrollback
defscrollback 65535
# Hardstatus line
hardstatus on
# https://www.gnu.org/software/screen/manual/html_node/String-Escapes.html
caption always "%{= kW}%S %{kw}%-w%{kG}[%n-%t]%{kw}%+w %= %{w}%H %{W}%Y-%m-%d %c:%s"
# disable vbell waring
# https://www.gnu.org/software/screen/manual/screen.html#Bell
vbell off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment