Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <42441D3B.6060506@buddydog.org> Date: Fri, 25 Mar 2005 09:16:27 -0500 From: Jonathan Arnold User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b) Gecko/20050202 MultiZilla/1.7.0.2d MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: rxvt problem: Prompt doesn't look very nice References: <4243160C DOT 7040503 AT buddydog DOT org> <4243C536 DOT 43CBA6C4 AT dessent DOT net> <424419BD DOT 9040005 AT byu DOT net> In-Reply-To: <424419BD.9040005@byu.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 >> 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 AT buddydog DOT 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/