Featured image of post Configuring the Terminal Prompt

Configuring the Terminal Prompt

I was recommended this tool to help you know what git branch you are working on from the terminal prompt.

https://github.com/jimeh/git-aware-prompt

Configurations

I added the configuration to my settings in:

vi ~/.bash_profile

1
2
3
4
5
6
7
# http://stackoverflow.com/questions/10406926/how-to-change-default-virtualenvwrapper-prompt

export GITAWAREPROMPT=~/.bash/git-aware-prompt
source "${GITAWAREPROMPT}/main.sh"
#/Users/patty/.virtualenvs/postactivate
export PS1="\n\u@\h\n[\w]\n\[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "
export SUDO_PS1="\n\[$bakred\]\u@\h\n\[$txtrst\][\w]\n\$ "

Then in virtualenvs postacivate I added:

vi /Users/pattyr/.virtualenvs/postactivate

1
2
3
4
# This hook is sourced after every virtualenv is activated
if [ "${_OLD_VIRTUAL_PS1:0:2}" == "\n" ]; then
    PS1="\n\[$txtylw\](`basename \"$VIRTUAL_ENV\"`)\n\[$txtrst\]${_OLD_VIRTUAL_PS1:2:${#_OLD_VIRTUAL_PS1}}"
fi

Before

Before git-aware-prompt - with and without venv

After

After git-aware-prompt - with and without venv
Built with Hugo
Theme Stack designed by Jimmy