Last active
August 20, 2019 08:16
-
-
Save badsyntax/f86975df1a768a84130a6e4360caa1cd to your computer and use it in GitHub Desktop.
.bashrc
This file contains hidden or 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
function nvm() { | |
echo "Lazy loading nvm..." | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
nvm "$@" | |
} | |
function setup-prompt() { | |
if [ -f "$(brew --prefix)/etc/bash_completion" ]; then | |
. $(brew --prefix)/etc/bash_completion | |
fi | |
export GIT_PS1_SHOWUNTRACKEDFILES=false | |
export GIT_PS1_SHOWDIRTYSTATE=false | |
export GIT_PS1_SHOWCOLORHINTS=true | |
export GIT_PS1_SHOWUPSTREAM="auto" | |
export GIT_PS1_DESCRIBE_STYLE="branch" | |
export PROMPT_DIRTRIM=4 | |
export PS1='\[\033[32m\]\u\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\n$ ' | |
} | |
function setup-aliases() { | |
alias ls='ls -lGF' | |
alias git-current-branch="git rev-parse --abbrev-ref HEAD" | |
} | |
function git-set-upstream() { | |
local CURRENT_BRANCH=$(git-current-branch) | |
git branch --set-upstream-to=origin/"$CURRENT_BRANCH" "$CURRENT_BRANCH" | |
} | |
function check_port() { | |
lsof -i :$1 | |
} | |
function setup-env() { | |
export GREP_OPTIONS='--color=always' | |
export EDITOR=vim | |
export NVM_DIR="$HOME/.nvm" | |
export NODE_EXTRA_CA_CERTS=~/certs/SSRVWMDHPKI001.pem | |
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-12.jdk/Contents/Home | |
export PATH="/Users/richardwillis/Library/Python/3.7/bin:$PATH" | |
} | |
function setup-direnv() { | |
eval "$(direnv hook bash)" | |
} | |
function serve() { | |
local PORT=$1 | |
if [ -z "$PORT" ]; then | |
PORT=8888 | |
fi | |
python -m SimpleHTTPServer "$PORT" | |
} | |
setup-env | |
setup-aliases | |
setup-direnv | |
PROMPT_COMMAND=setup-prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment