Created
October 5, 2015 20:48
-
-
Save ericrallen/9186f8db68cd7bfd1b5a to your computer and use it in GitHub Desktop.
Bash Stuff
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
# Load the .bashrc configuration whenever .bash_profile (this file) is sourced | |
if [ -f ~/.bashrc ]; then | |
source ~/.bashrc | |
fi |
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
#bash profile settings for @allenericr | |
#git completions | |
source `brew --prefix git`/etc/bash_completion.d/git-completion.bash | |
#user-specific stuff | |
PATH="/usr/local/bin:/usr/local/sbin:$PATH:$HOME/bin" | |
#git achievements | |
PATH="$PATH:$HOME/git/git-achievements" | |
# NODE Js | |
NODE_PATH="/usr/local/bin" | |
NODE_PATH="$NODE_PATH:/usr/local/lib/node_modules" | |
#use SublimeText as editor | |
EDITOR='sublime -w' | |
#lazy git | |
alias g='git' | |
# Autocomplete for 'g' as well | |
complete -o default -o nospace -F _git g | |
#forgot a sudo? redo! | |
alias redo=' sudo $(history -p \!\!)' | |
# copy ssh key | |
alias getssh=' pbcopy < ~/.ssh/id_rsa.pub' | |
# cd into directory and ls it | |
function cdl() { | |
cd $1; | |
ls; | |
} | |
# make a directory and cd into it in one command | |
function mdir () { | |
mkdir -p "$@" && eval cd "\"\$$#\""; | |
} | |
# Install a grunt plugin and save to devDependencies | |
function gi() { | |
npm install --save-dev grunt-"$@"; | |
} | |
# borrowed from: http://chrisawren.com/posts/Advanced-Grunt-tooling | |
# Install a grunt-contrib plugin and save to devDependencies | |
function gci() { | |
npm install --save-dev grunt-contrib-"$@"; | |
} | |
#borrowed from: http://chrisawren.com/posts/Advanced-Grunt-tooling | |
# Set Colours for Folders | |
export CLICOLOR=1 | |
export LSCOLORS=DxExFxFxfxaxaxaxaxaxax | |
# Prompt formatter | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/' | |
} | |
function parse_git_status { | |
# check if we're in a git repo | |
is_git=`git status 2> /dev/null` | |
if [ -z "$is_git" ] ; then | |
return 1 | |
fi | |
# check if there are changes | |
status=`git status 2> /dev/null | grep "nothing to commit"` | |
dirty_marker="Δ" | |
if [ "$status" != "nothing to commit, working directory clean" ] ; then | |
echo " $dirty_marker" | |
fi | |
} | |
function format_prompt { | |
local GREEN="\[\e[32m\]" | |
local RED="\[\033[1;31m\]" | |
local CYAN="\[\033[1;36m\]" | |
local DEFAULT="\[\033[0m\]" | |
local BLUE="\[\033[0;34m\]" | |
local YELLOWBOLD="\[\033[1;33m\]" | |
export PS1="$CYAN\n\w$GREEN\$(parse_git_branch)$YELLOWBOLD\$(parse_git_status)$RED\n> $DEFAULT" | |
} | |
format_prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment