how to change the prompt in Cygwin
Vidiot
brown@mrvideo.vidiot.com
Sun Jan 6 00:44:00 GMT 2008
>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@mymachien /cygdrive/c/Documents and Settings/Desktop
>$
>
>I want to change to
>
>user@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@vidiot.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/
More information about the Cygwin
mailing list