Skip to content

Instantly share code, notes, and snippets.

@gwenaelp
Created May 18, 2015 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwenaelp/bf5af3ae349e1e7e9a2c to your computer and use it in GitHub Desktop.
Save gwenaelp/bf5af3ae349e1e7e9a2c to your computer and use it in GitHub Desktop.
dotfiles
#Color table from: http://www.understudy.net/custom.html
source ~/.zshrc.local
fg_black=%{$'\e[0;30m'%}
fg_red=%{$'\e[0;31m'%}
fg_green=%{$'\e[0;32m'%}
fg_brown=%{$'\e[0;33m'%}
fg_blue=%{$'\e[0;34m'%}
fg_purple=%{$'\e[0;35m'%}
fg_cyan=%{$'\e[0;36m'%}
fg_lgray=%{$'\e[0;37m'%}
fg_dgray=%{$'\e[1;30m'%}
fg_lred=%{$'\e[1;31m'%}
fg_lgreen=%{$'\e[1;32m'%}
fg_yellow=%{$'\e[1;33m'%}
fg_lblue=%{$'\e[1;34m'%}
fg_pink=%{$'\e[1;35m'%}
fg_lcyan=%{$'\e[1;36m'%}
fg_white=%{$'\e[1;37m'%}
#Text Background Colors
bg_red=%{$'\e[0;41m'%}
bg_green=%{$'\e[0;42m'%}
bg_brown=%{$'\e[0;43m'%}
bg_blue=%{$'\e[0;44m'%}
bg_purple=%{$'\e[0;45m'%}
bg_cyan=%{$'\e[0;46m'%}
bg_gray=%{$'\e[0;47m'%}
#Attributes
at_normal=%{$'\e[0m'%}
at_bold=%{$'\e[1m'%}
at_italics=%{$'\e[3m'%}
at_underl=%{$'\e[4m'%}
at_blink=%{$'\e[5m'%}
at_outline=%{$'\e[6m'%}
at_reverse=%{$'\e[7m'%}
at_nondisp=%{$'\e[8m'%}
at_strike=%{$'\e[9m'%}
at_boldoff=%{$'\e[22m'%}
at_italicsoff=%{$'\e[23m'%}
at_underloff=%{$'\e[24m'%}
at_blinkoff=%{$'\e[25m'%}
at_reverseoff=%{$'\e[27m'%}
at_strikeoff=%{$'\e[29m'%}
PROMPT="${fg_name_color}${at_underl}%n${at_underloff}@%m${fg_white}[${fg_path_color}%~${fg_white}]"
#Set the auto completion on
autoload -U compinit
compinit
#Lets set some options
setopt correctall
setopt autocd
setopt auto_resume
## Enables the extgended globbing features
setopt extendedglob
#Set some ZSH styles
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
HISTFILE=~/.zsh-histfile
HISTSIZE=1000
SAVEHIST=1000
setopt prompt_subst
autoload colors zsh/terminfo
colors
function __git_prompt {
local DIRTY="%{$fg[yellow]%}"
local CLEAN="%{$fg[green]%}"
local UNMERGED="%{$fg[red]%}"
local RESET="%{$terminfo[sgr0]%}"
git rev-parse --git-dir >& /dev/null
if [[ $? == 0 ]]
then
echo -n "["
if [[ `git ls-files -u >& /dev/null` == '' ]]
then
git diff --quiet >& /dev/null
if [[ $? == 1 ]]
then
echo -n $DIRTY
else
git diff --cached --quiet >& /dev/null
if [[ $? == 1 ]]
then
echo -n $DIRTY
else
echo -n $CLEAN
fi
fi
else
echo -n $UNMERGED
fi
echo -n `git branch | grep '* ' | sed 's/..//'`
echo -n $RESET
echo -n "]"
fi
}
export RPS1='$(__git_prompt)[${fg_green}%*${fg_white}]${at_normal}'
export LD_LIBRARY_PATH=/usr/local/lib
#Aliases
##ls, the common ones I use a lot shortened for rapid fire usage
alias ls='ls --color' #I like color
alias l='ls -lFh' #size,show type,human readable
alias la='ls -lAFh' #long list,show almost all,show type,human readable
alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable
alias lt='ls -ltFh' #long list,sorted by date,show type,human readable
##cd, because typing the backslash is ALOT of work!!
alias .='cd ../'
alias ..='cd ../../'
alias ...='cd ../../../'
alias ....='cd ../../../../'
# SSH aliases - short cuts to ssh to a host
alias -g shost='ssh -p 9999 user@host.com'
alias hist='history | grep $1' #Requires one input
alias tilda='tilda c="tmux a"'
alias googlevim="google docs edit --editor vim --title "
alias subl2="/home/gwen/usr/opt/SublimeText2/sublime_text"
alias code="(subl . &)"
alias m="make"
alias ack="ack-grep"
alias sv="ack-grep --type=vala"
alias g="git"
alias ga="git add"
alias gp="git pull"
alias gs="git status"
alias gd="git diff"
alias gco="git checkout"
mcd() { [[ -n "$1" ]] && mkdir -p "$1" && cd "$1";}
testFlask() { wget "127.0.0.1:5000/$1" && cat "$1";}
export PATH=$PATH:/home/gwen/go/bin
export GOPATH=/home/gwen/go/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment