| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-Spam-Check-By: | sourceware.org |
| From: | Vidiot <brown AT mrvideo DOT vidiot DOT com> |
| Message-Id: | <200801050853.m058rBQ14400@mrvideo.vidiot.com> |
| Subject: | Re: how to change the prompt in Cygwin |
| To: | pythonsun AT gmail DOT com (sun) |
| Date: | Sat, 5 Jan 2008 02:53:09 -0600 (CST) |
| Cc: | cygwin AT cygwin DOT com |
| In-Reply-To: | <73b111e10801042026yae98af8m9e37e09a74cadb37@mail.gmail.com> from "sun" at Jan 05, 2008 12:26:43 PM |
| X-Mailer: | ELM [version 2.5 PL3] |
| MIME-Version: | 1.0 |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
>Could you please help on how to remove the path display in my Cygwin?
>It looks like following and I don't like it:
>
>user AT mymachien /cygdrive/c/Documents and Settings/Desktop
>$
>
>I want to change to
>
>user AT mymachien$
>
>it is concise and good enough. please suggest.
I use zsh, but the following can be modified to fit your needs:
if [[ xterm = $TERM || vt102 = $TERM ]]
then export PROMPT="%{^[[1m%}BRN <%h> %{^[[0m%}"
else export PROMPT="BRN <%h> "
fi
The first prompt lines sets the simple prompt in bold and the ^[ is the real
control character, not the ^ and [ characters. The second prompt line is
when it isn't an xterm or vt100 window (can't set the text in bold).
Because I still want to see the current path location, I send it to the
title bar:
if [[ xterm == $TERM || vt102 == $TERM ]]
then chpwd() echo -n "^[]2;${PWD}^G"
fi
if [[ xterm == $TERM || vt102 == $TERM ]]
then chpwd
fi
Again, the ^[ and ^G are real control characters. These lines go into the
.zshrc file.
The above method for setting the title bar isn't perfect, as it is easy
to change into a directory that ultimately doesn't call chpwd. When that
happens, just do a "cd ." and that will update the path.
Adjust to your taste and shell.
MB
--
e-mail: vidiot AT vidiot DOT com /~\ The ASCII
[I've been to Earth. I know where it is. ] \ / Ribbon Campaign
[And I'm gonna take us there. Starbuck 3/25/07] X Against
Visit - URL: http://vidiot.com/ / \ HTML Email
--
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |