Next: , Previous: , Up: Naming Windows   [Contents][Index]

10.1.3 Setting up your prompt for shell titles

One thing to keep in mind when adding a null title-escape-sequence to your prompt is that some shells (like the csh) count all the non-control characters as part of the prompt’s length. If these invisible characters aren’t a multiple of 8 then backspacing over a tab will result in an incorrect display. One way to get around this is to use a prompt like this:

set prompt='{No value for `esc'}[0000m{No value for `esc'}k{No value for `esc'}\% '

The escape-sequence ‘{No value for `esc'}[0000m’ not only normalizes the character attributes, but all the zeros round the length of the invisible characters up to 8.

Tcsh handles escape codes in the prompt more intelligently, so you can specify your prompt like this:

set prompt="%{\ek\e\\%}\% "

Bash users will probably want to echo the escape sequence in the PROMPT_COMMAND:

PROMPT_COMMAND='printf "\033k\033\134"'

(I used ‘\134’ to output a ‘\’ because of a bug in v1.04).