Skip to content

Instantly share code, notes, and snippets.

@AVGP
Last active October 26, 2015 13:02
Show Gist options
  • Select an option

  • Save AVGP/43a17bc96013209084c2 to your computer and use it in GitHub Desktop.

Select an option

Save AVGP/43a17bc96013209084c2 to your computer and use it in GitHub Desktop.
Shell prompt that displays the current user, the working directory and the current mercurial bookmark.
DEFAULT="[0m"
PINK="[35m"
GREEN="[32m"
ORANGE="[33m"
hg_branch() {
BOOKMARK=`hg branch 2> /dev/null`
if [ -n "$BOOKMARK" ]; then
BOOKMARK="\e${DEFAULT} on \e${ORANGE}$BOOKMARK\e${DEFAULT}"
fi
echo -e "$BOOKMARK"
}
export PS1='\n\e${PINK}\u \
\e${DEFAULT}in \e${GREEN}\w\
\e${DEFAULT}$(hg_branch) \n\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment