Archive for the ‘shell’ Category

I love the Zsh prompt used in Gentoo! Here it is…

Wednesday, September 16th, 2009

Since I am using the Zsh as default Shell on my Linux machines but not all of them are Gentoo based, I put the Gentoo prompt here.

Screenshot:
Zsh Gentoo prompt Screenshot

Just put the following lines to your .zshrc and you will be able to use this prompt on all distributions, not only Gentoo. Shure, I could copy the prompt file to the default directory in /usr/share/zsh/… but it is easier to just copy the .zshrc file from system to system…:

prompt_gentoo_setup () {
prompt_gentoo_prompt=${1:-'blue'}
prompt_gentoo_user=${2:-'green'}
prompt_gentoo_root=${3:-'red'}

if [ "$USER" = 'root' ]
then
base_prompt="%B%F{$prompt_gentoo_root}%m%k "
else
base_prompt="%B%F{$prompt_gentoo_user}%n@%m%k "
fi
post_prompt="%b%f%k"

#setopt noxtrace localoptions

path_prompt="%B%F{$prompt_gentoo_prompt}%1~"
PS1="$base_prompt$path_prompt %# $post_prompt"
PS2="$base_prompt$path_prompt %_> $post_prompt"
PS3="$base_prompt$path_prompt ?# $post_prompt"
}

prompt_gentoo_setup "$@"

Posted in: shell, zsh

Pages

Categories

account acta amsterdam android app arduino arm attiny automation avr beach board book circuit code community cross cyanogen denhaag denmark desaster deutsch device distribution diy dotnet electronics embedded extension firefox foo fosdem freedom freifunk friends fun games gcc gentoo german gnoduino hamburg header holiday host howto httpd internet irc jabber keitum kernel language lcd led lego leiden leo leo-search life linux madurodam mariadb matrix mindstorms minimal mobile monitoring moon music mysql nagios nas netduino netherland network news nxt ooc openmediavault opensource openwrt pcsc photos php politics programming question recovery robotics rsync sabayon scm sensor server service shell simulation smartcard snow soap space sun sweden sylt techno telemichel toolchain translation vpn website wine wiring wsdl xmpp zsh zynk

$Date: 2009-09-16 15:56:10 +0100 (Wed, 16 Sep 2009) $