My .screenrc

June 30, 2014

Recently, Wesley David put out a call for people to share their .screenrc files, even if they aren't particularly exciting. I am a regular but not heavy user of screen and have been for years now, so I have fixed opinions (and well-worn reflexes) but not very much cleverness.

So, here are bits of my .screenrc, annotated with comments.

The most important setting for me is the simplest:

escape ^_a

This makes the screen escape character into what I consider something sane and sensible. Here 'sane and sensible' really means 'so uncommon that basically nothing else uses it'. Almost all control characters are heavily used because there's only so many of them, but ^_ is just uncommon enough that I only rarely run into collisions.

(Back in the days of real terminals there was often somewhat of an adventure in figuring out how to generate a ^_ on a new terminal.)

Then:

bell_msg "Bell is present in window % (go look at it!)"
msgwait 30

One reason I have things set this is way is xterm's ziconbeep feature. If I run screen in an xterm, any ^G in any screen will produce a message and thus trigger ziconbeep, drawing my attention to that overall screen session.

Then I have some boring settings:

defscrollback 1000
startup_message off
multiuser off
autodetach on

(The latter two settings are theoretically the default, so mentioning them explicitly is paranoia. But I'm a sysadmin. Paranoia runs deep.)

If you're running screen in an xterm, screen normally puts its 'hardstatus' line in the xterm's titlebar. Because my xterms don't have title bars, I thus need to disable this, which I do by basically turning off hardstatus in xterms:

termcapinfo xterm* LP:hs@

My taste is to not have individual screen 'windows' be present in 'who' output and so on, for reasons that are pretty much historical at this point. So I have:

deflogin off
bind U login off
bind L login on

To be honest I don't think I've used those keybindings for a very long time. I might as well leave them there; after all, someday I may them.

There is one keybinding I use all the time:

bind - prev

One reason this binding is so useful and efficient for me is that it shares a physical keyboard key with ^_, making it very quick to invoke without shifting my fingers (I just lift my left fingers off the control and shift keys). I use 'space' to cycle forwards through screen windows, which is similarly easy to hit rapidly (the spacebar is a big target).

These days I run very boring things inside screen so I basically don't auto-start anything much. Most places I start out with one shell just sitting there:

screen 0

(My .screenrc also has comments about most of this, which has been very helpful in remembering enough about why I have these mysterious settings to be able to write this entry.)

As a side note on the great screen versus tmux debate: I don't do anything sophisticated or fancy with screen and I already know how to do things with it. Thus I currently see no reason to try to switch. In general I don't dp sophisticated stuff in screen in general; that's what multiple xterm windows are for. Screen is for unusual situations when I need something to persist and one instance for monitoring stuff on my office workstation when I'm at home (and even that is increasingly historical).


Comments on this page:

By Context checker at 2014-06-30 02:35:44:

s/term/tmux/ ?

By cks at 2014-06-30 15:07:55:

Oh, yes. Oops. Fixed now. Thanks for noticing.

By Ewen McNeill at 2014-06-30 19:47:14:

Thanks for sharing. It might not be "clever", but ctrl-_ for the escape key is inspired: it hadn't occurred to me before, but I don't recall anything else I use choosing it. Whereas both screen's default ctrl-a, and (apparently) tmux's default ctrl-b are key sequences I use all the time for other things (start of line in shell, page back in vim) so it's hugely disrupting of flow to have to remember whether or not I'm in screen/tmux and what the workaround is.

Ewen

By cks at 2014-06-30 23:39:59:

Emacs turns out to use ctrl-_ for undo, but it's also available as ctrl-x u (and that binding may be older) so I think I can live with that. I haven't spotted anything else, perhaps because ctrl-_ is so unusual.

(All of the non-ASCII control characters are a bit odd, really.)

FWIW, in tmux I’ve mapped the corresponding prefix to ^Z (with ^Z ^Z bound to send a ^Z to the program). Because for… some inscrutable reason 😉, I have not come across any terminal application that uses ^Z as a prefix in any sequence in its own key bindings.

Written on 30 June 2014.
« The tradeoffs for us in a SAN versus disk servers
Comparing RPM versions in the shell »

Page tools: View Source, View Normal.
Search:
Login: Password:

Last modified: Mon Jun 30 00:43:08 2014
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.