Last active
November 13, 2019 16:30
-
-
Save jorgearimitsu/ed8bacfcd8b9ef175f502f2651a0ebcd to your computer and use it in GitHub Desktop.
Bash Shell Config
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
# --- Prompt --- | |
export PS1='\[\033[38;5;45m\]\u\[$(tput sgr0)\]@\[\033[38;5;214m\]\h\[$(tput sgr0)\]:\[\033[38;5;250m\]\W\[$(tput sgr0)\]\[\033[0;32m\]$(parse_git_branch)\[$(tput sgr0)\] \$ ' | |
# --- Functions --- | |
# git highlight branch | |
parse_git_dirty() { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*" | |
} | |
parse_git_branch() { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} | |
# quick start a web server using python. It takes a port number as parameter | |
serve() { | |
python -m SimpleHTTPServer $1 | |
} | |
# --- Configs --- | |
# nvm | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm | |
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion | |
# rbenv | |
eval "$(rbenv init -)" | |
# --- Aliases --- | |
# list all files (hidden included) | |
alias lsa="ls -hal" | |
# start postgresql installed with homebrew | |
alias psql:start="pg_ctl -D /usr/local/var/postgres start" | |
# stop postgresql installed with homebrew | |
alias psql:stop="pg_ctl -D /usr/local/var/postgres stop" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment