screenrc 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. # For a complete list of available commands, see http://bit.ly/jLtj
  2. # Set the default program for new windows.
  3. shell zsh
  4. # Set default lines of scrollback.
  5. defscrollback 5000 # default: 100
  6. # Detach session on hangup instead of terminating screen completely.
  7. autodetach on # default: on
  8. # Message to display in the status line when activity is detected in a
  9. # monitored window.
  10. activity "activity in %n (%t) [%w:%s]~"
  11. # When a bell character is sent to a background window, screen displays a
  12. # notification in the message line. The notification message can be re-defined
  13. # by this command.
  14. bell_msg "bell in %n (%t) [%w:%s]~"
  15. # Select line break behavior for copying.
  16. crlf off # default: off
  17. # Select default utmp logging behavior.
  18. #deflogin off # default: on
  19. # If set to 'on', screen will append to the 'hardcopy.n' files created by the
  20. # command hardcopy; otherwise, these files are overwritten each time.
  21. hardcopy_append on # default: off
  22. # Set message displayed on pow_detach (when HUP is sent to screen's parent
  23. # process).
  24. pow_detach_msg "BYE"
  25. # Default timeout to trigger an inactivity notify.
  26. silencewait 30 # default: 30
  27. # Change text highlighting. See http://bit.ly/11RDGZ
  28. sorendition gK
  29. # Do NOT display copyright notice on startup.
  30. startup_message off # default: on
  31. # Set $TERM for new windows. I have more luck with 'linux' than Terminal's
  32. # default 'xterm-color' (^H problems). Comment out to use the default.
  33. term linux
  34. # Tweak termcap, terminfo, and termcapinfo entries for best performance.
  35. termcap linux 'AF=\E[3%dm:AB=\E[4%dm'
  36. termcap xterm* 'AF=\E[3%dm:AB=\E[4%dm'
  37. terminfo linux 'AF=\E[3%p1%dm:AB=\E[4%p1%dm'
  38. terminfo xterm* 'AF=\E[3%p1%dm:AB=\E[4%p1%dm'
  39. # Allow xterm / Terminal scrollbars to access the scrollback buffer. This
  40. # enables the behavior you'd expect, instead of losing the content that scrolls
  41. # out of the window.
  42. termcapinfo linux ti@:te@
  43. termcapinfo xterm* ti@:te@
  44. # Use visual bell instead of audio bell.
  45. #vbell on # default: ???
  46. # Message to be displayed when the visual bell is triggered.
  47. #vbell_msg " *beep* "
  48. # Get rid of screen 0
  49. # http://www.linuxquestions.org/questions/linux-software-2/gnu-screen-start-window-numbering-at-1-keep-window-number-0-from-ever-being-used-772580/
  50. bind c screen 1
  51. bind 0 select 10
  52. ##################################
  53. # Captions
  54. #
  55. # Control the display of the window captions.
  56. # Without the `always` option, captions will only show when there are multiple
  57. # windows.
  58. #
  59. # String Escapes, especially some Hard-to-Discover escapes, are described below.
  60. # For an age-old tool, screen documentation is not great.
  61. #
  62. # Great thanks to:
  63. # http://blog.quixey.com/2011/07/29/make-your-life-easier-with-gnu-screen/
  64. # http://aperiodic.net/screen/man:string_escapes
  65. # http://superuser.com/questions/212392/how-to-include-screens-session-name-in-hardstatus
  66. # http://superuser.com/questions/209585/adding-conditional-formatting-to-the-status-line-in-gnu-screen
  67. #
  68. # %{= kw} - clear existing format, set color to black/white background/foreground
  69. # %= - pad line with spaces to fill display width. In this case, centering can be
  70. # done by having `%=` on both the left and and right, as screen will
  71. # automatically make both paddings the same length.
  72. # More spacing and padding can be seen here:
  73. #
  74. # http://aperiodic.net/screen/truncation_padding_escapes
  75. #
  76. # I did not bother reading it.
  77. #
  78. # %-w - show windows smaller in number than the current
  79. # %+w - show windows greater in number than the current
  80. #
  81. # --- Note about the `L` flag ---
  82. # This was hard to catch in the docs.
  83. # Some screen escapes can be prefixed with 'L'.
  84. # For `%-Lw`, window flags are added to the window names,
  85. # For `%LD` and `%LM`, longer name are used
  86. #
  87. # %{+b} - add the bold attribute to the text
  88. # %n - window number
  89. # %t - window title
  90. # %f - window flags (for various states)
  91. # %?...%? - IF statement. Contents will only display if any ESCAPES produce at
  92. # least one char So, if `%f` resolves to nothing (i.e. there are no
  93. # other flags for this window), then nothing will be displayed.
  94. #
  95. # There is also an else, using `%:`, but I don't know how to use that.
  96. #
  97. caption always "%{= kw} %=%-Lw%{g}[%n* %t%? %f%?]%{= kw}%+Lw%="
  98. ##################################
  99. # Hardstatus Line
  100. #
  101. # Configure the use and emulation of the terminal's hardstatus line.
  102. # `lastline` will reserve the last line of the display for the hardstatus.
  103. # Prepending the word 'always' will force screen to use the type even if the
  104. # terminal supports a hardstatus line.
  105. #
  106. # Explanation of escapes
  107. #
  108. # %{k.} - change the background color. The `.` in place of the foreground
  109. # leaves the colour unchanged.
  110. # `%{.r}` would be redundant: single colours specified without other
  111. # modifiers are assumed to be foreground colour changes.
  112. #
  113. # Notice a space after this formatting - this is to force the following
  114. # padding escape to take the formatting. Otherwise, formatting will only
  115. # start from the next displayed character (the 'H' in 'Host:').
  116. #
  117. # %{+b r} - add bold, foreground red.
  118. # %{-} - special formatting escape saying, revert the last change to formatting
  119. # (in the first case, the adding of bold and red foreground)
  120. # %{y} - yellow foreground
  121. # %{m} - magenta foreground
  122. # %{b} - blue foreground
  123. # %H - Hostname
  124. # %1` - run `backtick` command with id = 1 (refer to below)
  125. # %u - other users in this window (surrounded by brackets)
  126. # %c - 24hr time
  127. # %LD - Long Day name (refer to L note above)
  128. # %d - day number
  129. # %m - month number
  130. # %Y - full year number
  131. #
  132. hardstatus alwayslastline "%{k.}%{y}Session: %{-}%{+b r}%?[%1`]%:[NoName]%? %{-}on %H%=%?%{-}Users: (%u)%?%=%{b}%c, %LD, %d.%m.%Y"
  133. msgwait 15
  134. ##################################
  135. # Backtick Commands
  136. #
  137. # Commands to call using the %` substitutions (e.g. in hardstatus line)
  138. # Potentially Very Powerful!
  139. # Note that any commands in backtick are expected to return only ONE line of
  140. # output (no idea what happens if there's more than that).
  141. #
  142. # Syntax:
  143. # backtick id lifespan autorefresh command [args...]
  144. #
  145. # id - number to use in substitution e.g. %2` would call backtick with id = 2
  146. # id = 0 is called simply with %`
  147. # lifespan - seconds to run command again
  148. # autorefresh - seconds to refresh caption and hardstatus text
  149. #
  150. # if both lifespan and autorefresh are 0, it is expected the command will
  151. # periodically produce a line of output. Once output is detected, hardstatus and
  152. # captions will refresh if necessary e.g. if command is a `tail -F`
  153. # get the sessionname that has been set by `C-a :sessionname` or by
  154. # `screen -S [name]`
  155. #
  156. backtick 1 30 30 sh -c 'screen -ls | grep --color=no -o "$PPID\.[^[:space:]]*" | sed s/$PPID\.// | sed s/ttys.*// | sed s/pts-.*//'
  157. ##################################
  158. # Default Windows
  159. #
  160. # In theory, you could use `chdir` before a `screen -t` to automate the changing
  161. # of directories, but I have found this troublesome if you just want screen for
  162. # other purposes (like performing Ubuntu release upgrades).
  163. #
  164. # Is there a way of toggling default windows on/off based on how we start
  165. # screen?
  166. #
  167. screen -t "controllers" 2
  168. screen -t "views" 3
  169. screen -t "models" 4
  170. screen -t "routes" 5
  171. screen -t "webroot" 6
  172. screen -t "libraries" 7
  173. screen -t "logs" 8
  174. screen -t "db" 9
  175. screen -t "extra" 10
  176. screen -t "home" 1