Skip to content

Instantly share code, notes, and snippets.

@2016rshah
Last active June 6, 2018 02:28
Show Gist options
  • Save 2016rshah/284f83703aff6257442faac5f120a2df to your computer and use it in GitHub Desktop.
Save 2016rshah/284f83703aff6257442faac5f120a2df to your computer and use it in GitHub Desktop.
Default terminal setup
# Custom prompt
#---------------
# Get the Git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Make Git branch a variable
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
# Includes custom character for the prompt, path, and Git branch name.
# Source: kirsle.net/wizards/ps1.html
export PS1="\n\[$(tput bold)\]\[$(tput setaf 1)\]\w\[$(tput setaf 3)\]\$(parse_git_branch) \[$(tput setaf 4)\]$ \[$(tput sgr0)\]"
# A nice theme is the default novel theme or https://github.com/mdo/ocean-terminal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment