Skip to content

Instantly share code, notes, and snippets.

@draganmarjanovic
Created June 30, 2016 13:10
Show Gist options
  • Save draganmarjanovic/52cf2c43dcb42e25b78c4f31b564ca0d to your computer and use it in GitHub Desktop.
Save draganmarjanovic/52cf2c43dcb42e25b78c4f31b564ca0d to your computer and use it in GitHub Desktop.
swaq
# Colours
maincolour="%{$fg_bold[white]%}"
altcolour="%{$fg[green]%}"
gitcolour="%{$fg[yellow]%}"
resetcolour="%{$reset_color%}"
usercolour="" #"%{fg[blue]%}"
hostcolour="%{$fg[blue]%}"
function prompt_hostname()
{
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
echo "$maincolour [$hostcolour%n@%m$maincolour]"
fi
}
function precmd() # Uses: setting user/root PROMPT1 variable and rehashing commands list
{
# Last command status
cmdstatus=$?
fail=`[ "$cmdstatus" != "0" ] && echo "%{$fg_bold[red]%} *"`
export PROMPT="$hostcolour# $USER$maincolour at $altcolour$HOST$maincolour in $gitcolour%~$maincolour [%*]
$maincolour→ $resetcolour$usercolour"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment