Skip to content

Instantly share code, notes, and snippets.

@kissifrot
Last active October 29, 2015 15:38
Show Gist options
  • Save kissifrot/e80e058f632ddafb8c8d to your computer and use it in GitHub Desktop.
Save kissifrot/e80e058f632ddafb8c8d to your computer and use it in GitHub Desktop.
My bash profile
########## CONFIGURATION ################
export HISTFILESIZE=4096 # Number of line to save
export HISTSIZE=1024 # Number of command to remember
export HISTCONTROL="ignoreboth" # dont save already entered commands, and command starting with a space (same as ignoredups:ignorespace)
### Editor
export EDITOR="vim"
export VISUAL=$EDITOR # screen oriented editor (as opposed to ed)
export FCEDIT=$EDITOR # edit command with vim
########## FOLDERS ALIAS ################
alias ~="cd ~"
####### VAGRANT ####################
if [ $UID -ne 0 ]; then
alias vagrant='sudo vagrant'
alias vg="sudo vagrant"
alias vup="sudo vagrant up"
alias vh="sudo vagrant halt"
alias vs="sudo vagrant suspend"
alias vr="sudo vagrant resume"
alias vrl="sudo vagrant reload"
alias vp="sudo vagrant provision"
alias vssh="sudo agrant ssh"
alias vstat="sudo vagrant status"
fi
####### FRONT-END TOOLS #########
alias gr=grunt
alias gu=gulp
alias v=vim
####### CMD ####################
alias c=clear
alias ll="ls -lahG"
alias lls="ls -ltra | grep '\->'"
alias lh='ls -lhd .?*'
alias lsd="ls -l | grep '^d'"
alias c--='cd --'
alias ..="cd .."
alias ..='cd ../' # Go back 1 directory level (for fast typers)
alias ...='cd ../../' # Go back 2 directory levels
alias .3='cd ../../../' # Go back 3 directory levels
alias .4='cd ../../../../' # Go back 4 directory levels
alias .5='cd ../../../../../' # Go back 5 directory levels
alias .6='cd ../../../../../../' # Go back 6 directory levels
alias al='vim ~/.bash_profile'
alias algc='vim ~/.gitconfig'
alias algi='vim ~/.gitignore'
alias h='history'
#strips off current comment from history so it doesn't show up
alias hg='history | head -$((`history | wc -l` - 1)) | grep -i '
# grep with color
alias g='grep --color=auto -i'
# refresh shell
alias reload='source ~/.bash_profile'
alias ntw='ifconfig en0 down && ifconfig en0 up'
alias ip='ifconfig | grep "inet " | grep -v 127.0.0.1'
# evite de faire de grosse bourdes
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ping='ping -c 5'
#########################################
process() {
ps -ef | grep $1
}
# perform 'ls' after 'cd' if successful.
cdls() {
builtin cd "$*"
RESULT=$?
if [ "$RESULT" -eq 0 ]; then
ll
fi
}
alias cdl='cdls'
# CSV viewer
csview()
{
local file="$1"
sed "s/,/\t/g" "$file" | less -S
}
# Command line pastebin http://ix.io
ix() {
local opts
local OPTIND
[ -f "$HOME/.netrc" ] && opts='-n'
while getopts ":hd:i:n:" x; do
case $x in
h) echo "ix [-d ID] [-i ID] [-n N] [opts]"; return;;
d) $echo curl $opts -X DELETE ix.io/$OPTARG; return;;
i) opts="$opts -X PUT"; local id="$OPTARG";;
n) opts="$opts -F read:1=$OPTARG";;
esac
done
shift $(($OPTIND - 1))
[ -t 0 ] && {
local filename="$1"
shift
[ "$filename" ] && {
curl $opts -F f:1=@"$filename" $* ix.io/$id
return
}
echo "^C to cancel, ^D to send."
}
curl $opts -F f:1='<-' $* ix.io/$id
}
####### GIT PROFIL SHELL ####################
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[1;34m\]"
LIGHT_RED="\[\033[1;31m\]"
SAUMON="\[\033[1;35m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
DEFAULT="\[\e[0m\]"
#source ~/git-prompt
source /usr/local/git/contrib/completion/git-completion.bash
source /usr/local/git/contrib/completion/git-prompt.sh
PS1_OLD=${PS1}
# Éviter l'auto-édit en merge réussi à partir de Git 2.0
export GIT_MERGE_AUTOEDIT=no
# Source http://www.git-attitude.fr/2013/05/22/prompt-git-qui-dechire/
export GIT_PS1_SHOWDIRTYSTATE=1 GIT_PS1_SHOWSTASHSTATE=1 GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM=verbose GIT_PS1_DESCRIBE_STYLE=branch
export GIT_PS1_SHOWCOLORHINTS=1
export PS1="🚀 ${BLUE}\!${DEFAULT} ${RED}\u${WHITE}:${SAUMON}\w ${YELLOW}$(__git_ps1) \[\e[0m\]\n${LIGHT_RED}\$${DEFAULT} "
###############################
### ENVIRONMENTAL VARIABLES ###
###############################
# Git command
export PATH="/usr/local/git/bin:$PATH"
#Symlink in the /usr/local/bin
export PATH="/usr/local/bin:$PATH"
# MacPorts Installer addition on 2014-10-24_at_14:22:10: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment