Permalink
Browse files

Initial commit. All bash stuffs

  • Loading branch information...
0 parents commit d33b6615a60f1ef15641e20817e2815135330971 @listrophy committed Mar 9, 2012
Showing with 71 additions and 0 deletions.
  1. +9 −0 .bash_login
  2. +12 −0 .bash_login.alias
  3. +4 −0 .bash_login.completion
  4. +2 −0 .bash_login.dircolors
  5. +1 −0 .bash_login.path
  6. +42 −0 .bash_login.prompt
  7. +1 −0 .bashrc
@@ -0,0 +1,9 @@
+source ~/.bash_login.prompt
+source ~/.bash_login.alias
+source ~/.bash_login.path
+source ~/.bash_login.dircolors
+source ~/.bash_login.completion
+
+source ~/.bash_login.local
+
+[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
@@ -0,0 +1,12 @@
+alias c='clear'
+
+alias l='ls -bF'
+alias ll='ls -lbF'
+alias lla='ls -albF'
+alias la='ls -abF'
+
+alias ..='cd ..'
+alias ::='cd ../..'
+alias :::='cd ../../..'
+alias ::::='cd ../../../..'
+alias :::::='cd ../../../../..'
@@ -0,0 +1,4 @@
+if [ -f `brew --prefix`/etc/bash_completion ]; then
+ . `brew --prefix`/etc/bash_completion
+fi
+
@@ -0,0 +1,2 @@
+export CLICOLOR=1
+export LSCOLORS=gxgxcxdxbxegedabagacad
@@ -0,0 +1 @@
+export PATH=~/bin:$PATH
@@ -0,0 +1,42 @@
+RED="\[\e[0;31m\]"
+GREEN="\[\e[0;32m\]"
+YELLOW="\[\e[0;33m\]"
+LIGHT_BLUE="\[\e[1;34m\]"
+COLOR_NONE="\[\e[0m\]"
+LIGHT_GRAY="\[\e[0;37m\]"
+
+function parse_git_deleted {
+ [[ $(git status 2> /dev/null | grep 'deleted:') != "" ]] && echo "-"
+}
+function parse_git_added {
+ [[ $(git status 2> /dev/null | grep "Untracked files:") != "" ]] && echo '+'
+}
+function parse_git_modified {
+ [[ $(git status 2> /dev/null | grep 'modified:') != "" ]] && echo "*"
+}
+function parse_git_dirty {
+ echo "$(parse_git_added)$(parse_git_modified)$(parse_git_deleted)"
+}
+function parse_git_branch {
+ git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1$(parse_git_dirty))/"
+}
+function prompt_dir {
+ if [[ $(git status 2>&1 | grep 'Not a git repository') != "" ]]
+ then
+ echo "\w"
+ else
+ local my_pwd=`pwd`
+ echo ${LIGHT_BLUE}${my_pwd#$(dirname $(git rev-parse --show-toplevel))/}${COLOR_NONE}
+ fi
+}
+function prompt_func {
+ previous_return_value=$?
+ prompt="${LIGHT_GRAY}$(prompt_dir)${YELLOW}$(parse_git_branch)${COLOR_NONE} "
+ if test $previous_return_value -eq 0
+ then
+ PS1="${GREEN}\h ${COLOR_NONE}${prompt}"
+ else
+ PS1="${RED}\h ${COLOR_NONE}${prompt}"
+ fi
+}
+PROMPT_COMMAND=prompt_func
@@ -0,0 +1 @@
+PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

0 comments on commit d33b661

Please sign in to comment.