Skip to content

Instantly share code, notes, and snippets.

@jamie-ga
Last active February 27, 2016 21:49
Show Gist options
  • Save jamie-ga/3f7e764a43d666e57ebe to your computer and use it in GitHub Desktop.
Save jamie-ga/3f7e764a43d666e57ebe to your computer and use it in GitHub Desktop.
Setting a custom ps1 variable
#!/bin/bash
# This hook is sourced after every virtualenv is activated.
# Added to $WORKON_HOME/.virtualenvs/postactivate
# color virtualenv name properly and put it after the \n if there is one at the start of the prompt
if [ ${_OLD_VIRTUAL_PS1:0:2} == '\n' ]; then
PS1="\n\[\033[$PROMPT_COLOR1\](`basename \"$VIRTUAL_ENV\"`) ${_OLD_VIRTUAL_PS1:2:${#_OLD_VIRTUAL_PS1}}"
else
PS1="\[\033[$PROMPT_COLOR1\](`basename \"$VIRTUAL_ENV\"`) $_OLD_VIRTUAL_PS1 "
#!/bin/bash
# Don't forget to activate this in .bashrc or .bash_profile (source ~/.set_ps1.sh)
# curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.sh
source ~/.git-prompt.sh
PS1=$'\[\e[0;36m\][\u@\h] \[\e[1;33m\]\w \[\e[0;32m\]$(__git_ps1 " (%s)") \[\e[0m\]\n \xe2\x86\xaa '
export PS1
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment