Last active
February 13, 2021 14:46
-
-
Save samlam/45a8bdd1deeff6a1a204855e44fe7867 to your computer and use it in GitHub Desktop.
Bash prompt (personal favorite)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias python='/c/ProgramData/Anaconda3/python.exe -i' | |
alias proj="cd "~/Documents/Projects" | |
alias loop="cd "~/Documents/Projects/costarGit/loopnet-listing-web" | |
alias mdlint="markdownlint '**/*.md' &> mdlint.log" | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
exitstatus() { | |
EXITSTATUS="$?" | |
BOLD="\[\033[1m\]" | |
RED="\[\033[1;31m\]" | |
GREEN="\[\e[32;1m\]" | |
BLUE="\[\e[34;1m\]" | |
YELLOW="\[\e[1;33m\]" | |
GRAY="\[\e[1;30m\]" | |
OFF="\[\033[m\]" | |
PROMPT="[\u@ ${BLUE}\$PWD${OFF}" | |
BRANCH="${GRAY}$(parse_git_branch)${OFF}" | |
if [ "${EXITSTATUS}" -eq 0 ] | |
then | |
PS1="${PROMPT} ${BOLD}${GREEN}:)${OFF} ] ${BRANCH} \n\$ " | |
else | |
PS1="${PROMPT} ${BOLD}${RED}:(${OFF} ] ${BRANCH} \n\$ " | |
fi | |
PS2="${BOLD}>${OFF} " | |
} | |
PROMPT_COMMAND=exitstatus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment