Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'explore man tcsh' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
explore man tcsh
Authored by: mervTormel on May 17, '02 02:50:18PM

explore man tcsh for prompt options that will help forego much code wrangling:

set prompt

%c[[0]n], %.[[0]n]
The trailing component of the current working
directory, or n trailing components if a digit
n is given. If n begins with `0', the number
of skipped components precede the trailing
component(s) in the format `/<skipped>trail-
ing'. If the ellipsis shell variable is set,
skipped components are represented by an
ellipsis so the whole becomes `...trailing'.
`~' substitution is done as in `%~' above, but
the `~' component is ignored when counting
trailing components.

shell special variables

ellipsis (+)
If set, the `%c'/`%.' and `%C' prompt sequences
(see the prompt shell variable) indicate skipped
directories with an ellipsis (`...') instead of


precmd Runs just before each prompt is printed. For
example, if one does

> alias precmd date

then date(1) runs just before the shell prompts
for each command. There are no limits on what
precmd can be set to do, but discretion should be

[ Reply to This | # ]
explore man tcsh
Authored by: lavacano on May 18, '02 02:55:53AM

using some ideas from this hint, and some from previous hints, I set my prompt to look like this:

>>> (05/18/02 6:35:13am) [user@host]
current path
prompt (%, #)

All color coded of coarse.

set prompt="\n%{\033[1;31m%}>>> (%{\033[34m%}%W/%D/%y} %{\033[0m%}%p%{\033[1;31m%}) [%{\033[0m%}%n%{\033[1;31m%}@%{\033[36m%}%M%{\033[1;31m%}]\n%{\033[1;37m%}%~\n%{\033[0m%}%# "

I find, to my tastes, this prompt looks the best with the colors from the SGI-ish theme for GLTerm (Blueish back, yellow text, blue cursor, purple selection) with heavier than average translucency, as the colors are easy to differentiate between.

[ Reply to This | # ]