Skip to content

Instantly share code, notes, and snippets.

@huynle
Last active January 17, 2020 16:13
Show Gist options
  • Save huynle/e39ed978b3bca5d7fb1c8290c23ec44e to your computer and use it in GitHub Desktop.
Save huynle/e39ed978b3bca5d7fb1c8290c23ec44e to your computer and use it in GitHub Desktop.
screenrc dotfile
# Add this to your bashrc to get reopen the same screen whenever SSH
# # alias dev="screen -DR dev"
# for esc to work with vim
maptimeout 5
# this is needed for term colors to work
term screen-256color
# term screen
# truecolor on
# this is needed for scrolling to work
termcapinfo xterm* ti@:te@
shell -${SHELL}
defscrollback 10000
# autodetach on
startup_message off
shelltitle '$ |bash'
# set space to list all windows
bind ' ' windowlist -b
# bind j focus down
# bind k focus up
# bind l focus right
# bind h focus left
bind h prev
bind l next
bind = resize =
bindkey -t "^A^[OC" resize -h +5
bindkey -t "^A^[OD" resize -h -5
bindkey -t "^A^[OA" resize -v -5
bindkey -t "^A^[OB" resize -v +5
bind z resize max max
# unbind the original quit
bind \
bind x
# bind it to new quit session
bind x quit
# bind to kill windows
bind q
bind K
bind q remove
# unbind cycling
bind n
# bind p
# unbind title
bind A
# rebind it to n
bind n title
# create new window with a shell
bind c screen
# unbind split horizontal and silence commands
bind S
bind _ eval "split" "focus next" "screen"
# bind _ eval "split" "focus next" "screen -t [name]"
bind | eval "split -v" "focus next" "screen"
# bind | eval "split -v" "focus next" "screen -t [name]"
bind t eval "screen"
hardstatus alwayslastline
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
# hardstatus string "%{= KW} %H [%`] %{= Kw}|%{-} %-Lw%{= bW}%n%f %t%{-}%+Lw %=%C%a %Y-%M-%d"
# host | time | date | load average | obligatory window
# hardstatus alwayslastline "%{b kw}%H %{r}%1` %{w}| %{g}%c %{w}| %{y}%d.%m.%Y %{w}| %{g}%l %{w}| %{-b kw}%u %-Lw%{= rW}%50> %n%f %t %{-}%+Lw%<"
# hardstatus alwayslastline "%{rk}%H %{gk}%c %{yk}%M%d %{wk}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{wk}%?%+Lw%?"
# make windows caption disappear
caption splitonly "%?%F%{= yk}%:%{= Kk}%? %n %t%="
caption string "%{kk}XXXXXXX"?
# Hide hardstatus: ctrl-a f
bind f eval "hardstatus ignore"
# # Show hardstatus: ctrl-a F
bind F eval "hardstatus alwayslastline"
altscreen on
windowlist string "%4n %h%=%f"
shell -${SHELL}
# pow_detach_msg "Screen session for \${LOGNAME} \$:cr:\$:nl:ended"
# logfile "$HOME/.log/screen.%n.%Y-%m-%d"
## FOR COPYING AND PASTING WITH VIM
setenv BUFFERFILE "$HOME/.buffer"
bufferfile "$BUFFERFILE"
###
screen -t dev 0 bash
# split
# focus next
screen -t make 1 bash
# resize -v -20
# focus prev
screen -t misc 3 bash
select 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment