Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Would like help with prompt




Hello!

This is my prompt (with some nice bolds and colors):

(kyrre@merhaba)(11:01+18/05)
(%:~)

It is set in /etc/zshrc like this:

PROMPT=$'%{\e[01;36m%}(%{\e[22;36m%}%n%{\e[01;30m%}@'
PROMPT+=$'%{\e[22;36m%}%m%{\e[01;36m%})%{\e[01;36m%}%{\e[01;36m%}('
PROMPT+=$'%{\e[22;36m%}%D{%H:%M}%{\e[01;30m%}+%{\e[22;36m%}%D{%d/%m}'
PROMPT+=$'%{\e[01;36m%})%{\e[01;30m\e[00m%}\n%{\e[01;36m%}('
PROMPT+=$'%{\e[22;36m%}%#%{\e[01;30m%}:%{\e[22;36m%}%~%{\e[01;36m%})'
PROMPT+=$'%{\e[01;30m\e[00m%} '

if [[ `whoami` = root ]] then

	PROMPT=$'%{\e[01;31m%}(%{\e[22;31m%}%n%{\e[01;30m%}@'
	PROMPT+=$'%{\e[22;31m%}%m%{\e[01;31m%})%{\e[01;31m%}%{\e[01;31m%}('
	PROMPT+=$'%{\e[22;31m%}%D{%H:%M}%{\e[01;30m%}+%{\e[22;31m%}%D{%d/%m}'
	PROMPT+=$'%{\e[01;31m%})%{\e[01;30m\e[00m%}\n%{\e[01;31m%}('
	PROMPT+=$'%{\e[22;31m%}%#%{\e[01;30m%}:%{\e[22;31m%}%~%{\e[01;31m%})'
	PROMPT+=$'%{\e[01;30m\e[00m%} '

fi

However this setup is darn ugly.

So I've been trying to simplify and adding some order to it:

I know I could load `colors' but I'm not sure if my colors are available. Anyway ...

local a1="01;36m"
local a2="22;36m"
local a3="01;30m"

local b1="01;31m"
local b2="22;31m"
local b3="01;30m"

PROMPT=$'%{$a1}(%{$a2}%n%{$a3}@%{$a2}%m%{$a1})'
PROMPT+=$'%{$a1}('{$a2}%D{%H:%M}%{$a3}+%{$a2}%D{%d/%m}%{$a1})%{$a3}\n'
PROMPT+=$'%{$a1}(%{$a2}%#%{$a3}:%{$a2}%~%{$a1})'

if [[ `whoami` = root ]] then

	PROMPT=$'%{$b1}(%{$b2}%n%{$b3}@%{$b2}%m%{$b1})'
	PROMPT+=$'%{$b1}%{$b1}(%{$b2}%D{%H:%M}%{$b3}+%{$b2}%D{%d/%m}%{$b1})%{$b3}\n'
	PROMPT+=$'%{$b1}(%{$b2}%#%{$b3}:%{$b2}%~%{$b1})'

fi

But so far that doesn't work:

/etc/zshrc:32: parse error near `)'
$a1}($a2}kyrre$a3}@$a2}merhaba$a1})

Maybe somebody out there can offer me some help?

Thanks a lot,
Kyrre



Messages sorted by: Reverse Date, Date, Thread, Author