Created
June 20, 2009 02:01
-
-
Save piyo/133000 to your computer and use it in GitHub Desktop.
sample Gnu Screen file with explicit keyboard bindings (showing defaults)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- conf-unix -*- | |
# Add environment variable so can do fancy terminal customization in shells | |
setenv GNU_SCREEN "yes" | |
# ---------------------------------------------------------------------- | |
# Keybindings | |
# ---------------------------------------------------------------------- | |
# screen's shortcut entry character, cannot be set to ^Q | |
escape "^T^T" | |
## 123 row | |
#def# bind 1 select 1 | |
#def# bind 2 select 2 | |
#def# bind '"' windowlist -b | |
#def# bind 3 select 3 | |
#def# bind 4 select 4 | |
#def# bind 5 select 5 | |
#def# bind 6 select 6 | |
#def# bind 7 select 7 | |
#def# bind 8 select 8 | |
#def# bind 9 select 9 | |
#def# bind 0 select 0 | |
#def# bind - select - | |
#def# bind = | |
#def# bind ^^ | |
#def# bind ~ | |
#def# bind | split -v | |
## qwerty row | |
#def# bind "q" xon | |
#def# bind "Q" only | |
#def# bind "^q" xon | |
#def# bind "w" windows | |
#def# bind "W" width | |
#def# bind "^w" windows | |
#def# bind "e" | |
#def# bind "E" | |
bind "^e" focus up #def# bind "^e" | |
#def# bind "r" wrap | |
#def# bind "R" | |
#def# bind "^r" wrap | |
#def# bind "t" time | |
#def# bind "T" | |
#def# bind "^t" time | |
#def# bind "y" | |
#def# bind "Y" | |
#def# bind "^y" | |
#def# bind "u" | |
#def# bind "U" | |
#def# bind "^u" | |
#def# bind "i" info | |
#def# bind "I" | |
#def# bind "^i" focus | |
#def# bind "o" | |
#def# bind "O" | |
#def# bind "^o" | |
#def# bind "p" prev | |
#def# bind "P" | |
#def# bind "^p" prev | |
#def# bind "@" | |
#def# bind "^@" next | |
#def# bind "'" select | |
#def# bind "[" copy | |
#def# bind "^[" copy | |
#def# bind "{" history | |
#def# bind "^{" | |
## asdf row | |
#def# bind "a" meta | |
#def# bind "A" title | |
bind "^a" sessionname #def# bind "^a" other | |
#def# bind "s" xoff | |
#def# bind "S" split | |
bind "^s" prev #def# bind "^s" xoff | |
#def# bind "d" detach | |
#def# bind "D" pow_detach | |
bind "^d" focus down #def# bind "^d" detach | |
#def# bind "f" flow | |
#def# bind "F" fit | |
bind "^f" next #def# bind "^f" flow | |
#def# bind "g" | |
#def# bind "G" | |
bind ^g version #def# bind "^g" vbell | |
#def# bind "h" hardcopy | |
#def# bind "H" log | |
#def# bind "^h" prev | |
#def# bind "j" | |
#def# bind "J" | |
#def# bind "^j" | |
#def# bind "k" kill | |
#def# bind "K" | |
#def# bind "^k" kill | |
#def# bind "l" redisplay | |
#def# bind "L" login | |
#def# bind "^l" redisplay | |
#def# bind ";" | |
#def# bind ";" | |
#def# bind "^;" | |
#def# bind "+" | |
#def# bind ":" colon | |
#def# bind "*" displays | |
#def# bind "]" paste . | |
#def# bind "^]" paste . | |
#def# bind "}" history | |
#def# bind "^}" | |
## zxcv row | |
#def# bind "z" suspend | |
#def# bind "Z" reset | |
#def# bind "^z" suspend | |
bind "x" command -c emacsx #def# bind "x" lockscreen | |
#def# bind "X" remove | |
bind "^x" command -c emacsx #def# bind "^x" lockscreen | |
bind "c" copy #def# bind "c" screen | |
#def# bind "C" clear | |
bind "^c" copy #def# bind "^c" screen | |
bind "v" paste . #def# bind "v" version | |
bind "V" digraph #def# bind "V" | |
bind "^v" paste . #def# bind "^v" digraph | |
#def# bind "b" break | |
#def# bind "B" pow_break | |
#def# bind "^b" break | |
bind "n" screen #def# bind "n" next | |
#def# bind "N" number | |
bind "^n" screen #def# bind "^n" next | |
#def# bind "m" lastmsg | |
#def# bind "M" monitor | |
#def# bind "^m" lastmsg | |
#def# bind "," license | |
#def# bind "<" readbuf | |
#def# bind "^<" | |
#def# bind "." dumptermcap | |
#def# bind ">" writebuf | |
#def# bind "^>" | |
#def# bind "/" | |
#def# bind "^/" | |
#def# bind "?" help | |
#def# bind "^?" prev | |
#def# bind "\" | |
#def# bind "^\" quit | |
#def# bind "_" silence | |
#def# bind "^_" | |
## Spacebar row | |
#def# bind "sp" next | |
## Submenus | |
# make the interface like emacs | |
bind -c emacsx "1" only | |
bind -c emacsx "2" split | |
bind -c emacsx "3" split -v | |
bind -c emacsx "o" focus | |
bind -c emacsx "b" windowlist | |
# no flow control, e.g. ^S and ^Q | |
defflow off | |
#01# Emacs keys in copy-scrollback mode | |
#01# From http://snarfed.org/space/Emacs+keybindings+in+GNU+screen's+copy-scrollback+mode | |
# emacs keybindings for navigation in copy mode | |
#01#markkeys ^B=Y:^F=V:h=^B:l=^F:0=^A:$=^E | |
# explained below | |
# set keys Y and V as emacs:"scroll up" and emacs:"scroll down" respectively | |
# not very emacs-y and notice you need to press shift. | |
# added 20060705-1204Wed, use k and j as emacs:(scroll-up) and emacs:(scroll-down) respc | |
markkeys ^B=Y=k:^F=V=j | |
# set keys ^B and ^F as emacs:(backward-char) and emacs:(forward-char) respc | |
markkeys h=^B:l=^F | |
# set keys ^A and ^E as emacs:(line-head) and emacs:(line-end) respc | |
markkeys 0=^A:$=^E | |
#01# C-g and other keys quit copy mode. Esc does nothing. | |
#01# markkeys \033=\015=^G=^D=h=j=k=l=H=M=L=G=g=y=c=v=a=x=b=e=B=E=w | |
# do not overwrite j and k | |
markkeys \033=\015=^G=^D=h=l=H=M=L=G=g=y=c=v=a=x=b=e=B=E=w | |
markkeys @=\033 | |
#01# special hack for C-e, since it should go *past* the last char. | |
#01# (-m means this is for copy mode only.) | |
bindkey -m ^e stuff "\$^f" | |
#01# page up and page down | |
bindkey -m -k kP stuff Y | |
bindkey -m -k kN stuff V | |
#01# C-space sets mark. unfortunately, markkeys doesn't do it, i need bindkey. | |
#01# markkeys " =^``" | |
bindkey -m "^ " stuff " " | |
#01# copy word under point. (disabled since it overrode typing w in isearch :P) | |
#01# markkeys W=w | |
#01# control arrows move by words. (set B, e, and w to F keys so that i can use | |
#01# them to move by words, but they themselves still quit copy mode.) | |
markkeys B=[:E=]:b={:e=}:w=> | |
bindkey -m ^[Od stuff { #"[[}" | |
bindkey -m ^[Oc stuff ] #"}]^f" | |
#01# # M-w copies region, W escapes out of i-search and copies word. afterward, | |
#01# # synchronize the paste buffer with the X selection. | |
#01# bindkey -m \033w eval "stuff ' '" writebuf "exec sh -c 'xsel -n < /tmp/screen-exchange'" | |
#01# | |
#01# # evidently only C-g, Esc, and C-space break out of i-search. so, use | |
#01# # C-space, because with my setup, it doesn't break out of copy mode too. | |
#01# # markkeys "^ =^u" | |
#01# bindkey -m W eval "stuff \033W" writebuf "exec sh -c 'xsel -n < /tmp/screen-exchange'" | |
#01# | |
#01# End | |
# ---------------------------------------------------------------------- | |
# Visuals | |
# ---------------------------------------------------------------------- | |
# Set the caption to something interesting | |
# You need the screen(1) man page just to decipher this junk! | |
# dark gray bkgrd with (active) white / (inactive) black text | |
# '1&$ zsh 0.00 0.01 0.00@sugarc 17Thr14:36' | |
# | |
# wanted to do %?%F in the %= area, but it doesn't work in screen-4.0.2?!? | |
# %? is not the general conditional "if" that you want it to be | |
# I also wish that windows starts with 1 instead of 0. | |
# I also wish that -M accepted in the config file, is also accepted in the command line. | |
setenv s "$s%{= Kw}" # in white on Bright black, | |
setenv s "$s%?%F" # if (?) window has focus (F) | |
setenv s "$s%{..I}" # then make foreground text Bright (white) | |
setenv s "$s%:%{..k}%?" # else make the foreground text black | |
setenv s "$s%n" # show current window number | |
setenv s "$s%f" # show current window flags (starting right justified area) | |
setenv s "$s " # SPACE | |
setenv s "$s%t" # show title | |
setenv s "$s%=" # pad to display width (ended left justified area) | |
setenv s "$s%l@%H" # show load and "@" host | |
setenv s "$s " # SPACE | |
setenv s "$s%{Y}" # in yellow | |
setenv s "$s%1`" # show backtick 1 | |
caption always "$s" | |
unsetenv s | |
# Instead of using caption .. "... %d%D%a" | |
# %-k == 0..23, do not pad | |
backtick 1 60 60 env LANG=C LC_ALL=C date +"%-d%a%-k:%M" | |
# Advanced GNU screen usage: | |
# C-a _ (monitor silence, this window) and C-a M (monitor activity, all windows?) is very interesting | |
#03# # Snarfed from http://www.tenox.tc/out/screenrc.txt | |
#03# # on 20060817-1230Thu | |
#03# caption always "%{= gk}%-Lw%{= bW}%50> %n%f* %t %{-}%+Lw%< %= %{= rk} %H %l %{= gk} %0c:%s %{-}" | |
#03# # Explanation: | |
#03# # %{= gk} In black on green, | |
#03# # %-Lw ... show other windows (w) with flags (L) before current (-) | |
#03# # %{= bW} In bright white on blue, | |
#03# # %50> ... ?expand this field for the next truncation, 50 characters? | |
#03# # %n%f* %t ... show current window number (n), flags (f), title (t) with * signifying current window | |
#03# # %{-} In black on green, (restore colors to previous) | |
#03# # %+Lw ... show other windows (w) with flags (L) after current (+) | |
#03# # %< %= Just truncate here (<) then pad with spaces to the right end of the display (=) | |
#03# # %{= rk} In black on red | |
#03# # %H %l ... show hostname (H) and load (l) | |
#03# # %{= gk} In black on green | |
#03# # %0c:%s ... show hour:min:sec in 24 format. | |
#03# # %{-} (restore colors to previous) | |
# I don't want to see the license startup screen every time. | |
startup_message off | |
# And show the command for the windows when they're resurrected. | |
verbose on | |
#02# 256 color support | |
#02# from http://qootas.org/blog/archives/2006/03/256_colors_putt.html | |
#02# from http://frexx.de/xterm-256-notes/ | |
#02# erase background with current bg color | |
defbce "on" | |
#02# do not use 'screen-bce' | |
term xterm-256color | |
#term screen-256color # function keys don't work | |
# if GNU screen's term is unset, then colors will be 8. | |
# By setting this, "tput colors" will output 256 instead of 8. | |
#02# End | |
# ---------------------------------------------------------------------- | |
# Behavior | |
# ---------------------------------------------------------------------- | |
# Save scroll history way way back | |
defscrollback 10000 | |
# "Sets whether screen will automatically detach (keep running) upon hangup. | |
# The default is 'on'" | |
# Never, ever turn this off. | |
autodetach on | |
# Keep dead windows around until I tell them to exit. | |
zombie cr | |
# If a window goes unresponsive, don't block the whole session waiting for it. | |
nonblock on | |
# case insensitive search | |
ignorecase on | |
# end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment