This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: rxvt problem: Prompt doesn't look very nice


Eric Blake wrote:
According to Brian Dessent on 3/25/2005 1:00 AM:

The first line above of PS1 is an escape sequence that tells the
terminal to change the window title to the given string.  Emacs
apparently does not support that escape sequence, so you'll have to
modify your prompt.  The Cygwin default is

PS1='\[\033]0;\w\007\n\033[32m\]\u@\h \[\033[33m\w\033[0m\]\n$ '

And this is an evil default in /etc/profile, because it does not correctly delineate printing vs non-printing characters, and hence messes up bash in computing prompt width. Can we please get base-files updated, to actually use \[ and \] only around non-printing characters? Also, bash supports \e for \033, and \a for \007, and uses \$ to print $ for normal users vs # for root (man bash, search for PROMPTING for other cool escape sequences). I would prefer the cygwin default for bash to be:

PS1='\[\e]0;\w\a\e[32m\]\n\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '

Well, I'm hoping I can find the time to propose a bash update this weekend to the official packages. I finally found a reference to a nice "recipe" for building a package, as the Cygwin package web page is a little overwhelming. But via the FAQ, there's a pointer to a very concise posting by Charles Wilson on how to do it, and I'm going to try and get to this weekend. If it is under control of the bash package, then I will add this in. But it may not be.

See google or
<http://www.dee.ufcg.edu.br/~rrbrandt/tools/ansi.html> for more details.


That page only covered ANSI sequences, or "\e[...".  It did not cover
xterm sequences, or "\e]..."  See
http://networking.ringofsaturn.com/Unix/Bash-prompts.php for details on
setting the xterm title and icon using "\e]0;...\a", "\e]1;...\a", and
"\e]2;...\a".  This page also recommends examining $TERM before setting
PS1 to use \e]..., since it those escapes work when TERM is cygwin or
xterm, but don't work when it is emacs or vt100.

Someone either posted here, or I found a link to, a nice .bashrc. In it, there was:

# Setup color variables
BLACK="\[\033[0;30m\]"
DGRAY="\[\033[1;30m\]"
RED="\[\033[0;31m\]"
LRED="\[\033[1;31m\]"
GREEN="\[\033[0;32m\]"
LGREEN="\[\033[1;32m\]"
BROWN="\[\033[0;33m\]"
YELLOW="\[\033[1;33m\]"
BLUE="\[\033[0;34m\]"
LBLUE="\[\033[1;34m\]"
PURPLE="\[\033[0;35m\]"
LPURPLE="\[\033[1;35m\]"
CYAN="\[\033[0;36m\]"
LCYAN="\[\033[1;36m\]"
LGRAY="\[\033[0;37m\]"
WHITE="\[\033[1;37m\]"
NEUTRAL="\[\033[0m\]"

export BLACK DGRAY RED LRED GREEN LGREEN BROWN YELLOW BLUE
export LBLUE PURPLE LPURPLE CYAN LCYAN LGRAY WHITE NEUTRAL

which is kinda nice. So that means my PS1 is:

export PS1="*** $LCYAN\@$NEUTRAL *** $YELLOW\w$NEUTRAL ***\n\r$NEUTRAL"

There's a bunch of nice .bashrc examples, as a quick Google scan found.

--
Jonathan Arnold     (mailto:jdarnold@buddydog.org)
Amazing Developments       http://www.buddydog.org

I feel like a fugitive from the law of averages. -
 William H. Mauldin


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]