Skip to content

Instantly share code, notes, and snippets.

@lokori
Created October 17, 2018 18:26
Show Gist options
  • Save lokori/fd09e9a682da8e293cf544dff98a2e82 to your computer and use it in GitHub Desktop.
Save lokori/fd09e9a682da8e293cf544dff98a2e82 to your computer and use it in GitHub Desktop.
The good prompt from the bash profile. Line wrapping issues. Needs git-complete. Nice prompt
# start at home
cd ~
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
ln -sfv /usr/local/opt/mysql56/*.plist ~/Library/LaunchAgents
export PATH=./node_modules/.bin:$PATH
export PATH=/usr/local/Cellar/mysql56/5.6.29/bin:$PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
EC2_HOME=/usr/local/ec2/ec2-api-tools-1.7.5.1
export PATH=$PATH:EC2_HOME/bin
# Export private NPM token for ST
export SOCIALTABLES_NPM_TOKEN=f097d22d-aab5-45c8-b0ac-8b6cecd95ab2
#use a big file descriptor
ulimit -n 10240
[[ -s "$HOME/.avn/bin/avn.sh" ]] && source "$HOME/.avn/bin/avn.sh" # load avn
export NVM_DIR="/Users/johnoakley/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
eval $(docker-machine env)
export FIREFOX_BIN=/Applications/Firefox.app/Contents/MacOS/firefox
# export DB_HOST=onsite-debug-sandbox.csghhjwtsiva.us-east-1.rds.amazonaws.com
# export DB_DATABASE=socialtables_brie
# export DB_NAME=socialtables_brie
# export DB_USER=onsite
# export DB_USERNAME=onsite
# export DB_PASS=81f744f4ae20
# export DB_PASSWORD=81f744f4ae20
# export DB_HOST=sandbox001.csghhjwtsiva.us-east-1.rds.amazonaws.com
# export DB_DATABASE=socialtables_sandbox
# export DB_NAME=socialtables_sandbox
# export DB_USER=sqluser
# export DB_USERNAME=sqluser
# export DB_PASS=kBe9*ec3SF
# export DB_PASSWORD=kBe9*ec3SF
# export NODE_ENV=test
# export AUTH_HOST=127.0.0.1:2477
# export DB_HOST=127.0.0.1
# export DB_NAME=socialtables_local
# export DB_USER=root
# export DB_PASSWORD=
# export SQL_QUERY_LOGGING=false
# export AWS_S3_AVATAR_BUCKET="socialtables-guest-avatars-dev"
# export S3_BR_RESIZED_BUCKET="socialtables-bookable-room-images-resized-dev"
# export SPACE_IMAGE_HOST="https://socialtables-space-images-resized-dev.s3.amazonaws.com"
# export BOOKABLE_ROOM_IMAGE_HOST="https://socialtables-bookable-room-images-resized-dev.s3.amazonaws.com"
### Cursor Configuration ###
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM='gnome-256color';
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM='xterm-256color';
fi;
prompt_git() {
local s='';
local branchName='';
# Check if the current directory is in a Git repository.
if [ $(git rev-parse --is-inside-work-tree &>/dev/null; echo "${?}") == '0' ]; then
# check if the current directory is in .git before running git checks
if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == 'false' ]; then
# Ensure the index is up to date.
git update-index --really-refresh -q &>/dev/null;
# Check for uncommitted changes in the index.
if ! $(git diff --quiet --ignore-submodules --cached); then
s+='+';
fi;
# Check for unstaged changes.
if ! $(git diff-files --quiet --ignore-submodules --); then
s+='!';
fi;
# Check for untracked files.
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
s+='?';
fi;
# Check for stashed files.
if $(git rev-parse --verify refs/stash &>/dev/null); then
s+='$';
fi;
fi;
# Get the short symbolic ref.
# If HEAD isn't a symbolic ref, get the short SHA for the latest commit
# Otherwise, just give up.
branchName="$(git symbolic-ref --quiet --short HEAD 2> /dev/null || \
git rev-parse --short HEAD 2> /dev/null || \
echo '(unknown)')";
[ -n "${s}" ] && s=" [${s}]";
blue="";
echo -e "${1}${branchName}${blue}${s}";
else
return;
fi;
}
bold='';
reset="\e[0m";
black="\e[1;30m";
blue="\e[1;34m";
cyan="\e[1;36m";
green="\e[1;32m";
orange="\e[1;33m";
purple="\e[1;35m";
red="\e[1;31m";
violet="\e[1;35m";
white="\e[1;37m";
yellow="\e[1;33m";
# Highlight the user name when logged in as root.
if [[ "${USER}" == "root" ]]; then
userStyle="${red}";
else
userStyle="${orange}";
fi;
# Highlight the hostname when connected via SSH.
if [[ "${SSH_TTY}" ]]; then
hostStyle="${bold}${red}";
else
hostStyle="${yellow}";
fi;
# Provide notification of node version
promptNVM() {
if [ "x" != "x$NVM_BIN" ]; then
echo -e "${white} on ${red}$(nvm current)"
fi
}
# Bash completion script
source ~/git-completion.bash
# Set the terminal title to the current working directory.
PS1="\[\033]0;\w\007\]";
#PS1+="\[${bold}\]\n"; # newline
#PS1+="\[${userStyle}\]\u"; # username
## PS1+="\[${white}\] at ";
## PS1+="\[${hostStyle}\]\h"; # host
#PS1+="\$(promptNVM)";
#PS1+="\[${white}\] in ";
PS1+="\[${green}\]\w"; # working directory
PS1+="\$(prompt_git \"${white} on ${violet}\")"; # Git repository details
#PS1+="\n";
PS1+=" ";
PS1+="\[${white}\]\$ \[${reset}\]"; # `$` (and reset color)
export PS1;
PS2="\[${yellow}\]→ \[${reset}\]";
export PS2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment