Tuesday, December 23, 2008

Fix up screen good

Awhile ago, I set up screen on another machine.

I was setting up my screen config for a new machine, and I had completely forgotten how I had fixed it up.

Here's what I did:

  • don't bother with aliasing 'screen' to 'TERM=screen screen'
  • to fix backspace-delete, instead put 'bindkey -k kD stuff ^H' in .screenrc (note ^H should be entered as cntrl-V-cntrl-H to get a literal)
  • to get color shell prompts in bash:
    • there should be a line in .bashrc that looks like case "$TERM" in xterm-color) color_prompt=yes;; esac
    • add screen) color_prompt=yes;; into the body of the case statement
  • to get window titles added correctly, for bash:
    • add this to .screenrc: shelltitle '$ |bash'
    • add this to .bashrc: PS1=$PS1'\[\033k\033\\\]'
  • to get window titles added correctly for zsh, add the following to .zshrc:
    • preexec () { echo -ne "\ek${1%% *}\e\\"}
    • precmd () { echo -ne "\ekzsh\e\\" }
  • put 'shell zsh' in .screenrc to start with zsh automatically
  • startup_message off to disable the startup message
  • a status line config that I like: '%{kw}[%{kw}%?%-Lw%?%{=b wR}(%{k}%n*%f %t%?(%u)%?%{=b wR})%{= wk}%?%+Lw%?%?%= %{= }]%{g}[%l]'
I found some of these example configs helpful, especially for deciphering the caption/hardstatus lines:

No comments: