Skip to content

Instantly share code, notes, and snippets.

@branquito
Created March 20, 2013 19:32
Show Gist options
  • Save branquito/5207723 to your computer and use it in GitHub Desktop.
Save branquito/5207723 to your computer and use it in GitHub Desktop.
BASH-settings-for-WIN
### PROMPT ####################
# function parse_git_dirty {
# [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
# }
#
# function parse_git_branch {
# git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
# }
#
# COLOR_GRAY="\\[\\033[0;37m\\]"
# COLOR_WHITE="\\[\\033[1;37m\\]"
# COLOR_GREEN="\\[\\033[0;32m\\]"
# COLOR_RED="\\[\\033[0;31m\\]"
# COLOR_YELLOW="\\[\\033[1;33m\\]"
# COLOR_BLUE="\\[\\033[1;34m\\]"
#
# if [[ /Users/$USER != $HOME ]] ; then
# PROMPT_USERNAME="$COLOR_RED$USER$COLOR_WHITE "
# else
# PROMPT_USERNAME=""
# fi
#
# export PS1=$PROMPT_USERNAME'$(__git_ps1 "\[\e[0;32m\]%s\[\e[0m\]\[\e[0;33m\]$(parse_git_dirty)\[\e[0m\] ")\w$ '
export GIT_PS1_SHOWDIRTYSTATE=1
export PS1='\[\033[01;32m\]\u@\h\[\033[01;35m\] \w\[\033[01;33m\]$(__git_ps1)\[\033[01;32m\] \$\[\033[00m\] '
## source .bashrc ##
alias reload='. .bashrc'
## handy shortcuts ##
alias h='history'
alias h.20='history 20'
## create a new set of commands ##
alias path='echo -e ${PATH//:/\\n}'
alias now='date +"%T"'
alias nowtime=now
alias nowdate='date +"%d-%m-%Y"'
## make life in colors ##
alias ls='ls --color=tty'
alias c='clear'
## use long listing as default ##
alias ls='ls -la'
## show hidden files ##
alias l.='ls -d .* --color=auto'
alias docs='cd /c/xampp/htdocs/'
alias sub='/c/Program\ Files/Sublime\ Text\ 2/sublime_text.exe'
## get rid of command not found ##
## and make life easier ##
alias cd..='cd ..'
alias ..='cd ..'
## run git daemon, to serve repository locally ##
alias shareproject='git daemon --export-all --base-path=/c/xampp/htdocs'
## easy export db using .git/hooks scripts ##
alias edb='. .git/hooks/pre-commit.noactive'
alias idb='. .git/hooks/post-merge'
## custom functions
function ext-ip () { curl http://ipecho.net/plain; echo; }
## connect to a remote mysql, easy
alias b_mysql='mysql --host=192.168.1.33 -u root -prootpass'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment