Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 241 lines (189 sloc) 6.39 KB
setopt correct
autoload -U edit-command-line
zle -N edit-command-line
bindkey -v
bindkey -M vicmd v edit-command-line
bindkey '^R' history-incremental-search-backward
bindkey '^S' history-incremental-search-forward
bindkey '^P' history-search-backward
bindkey '^N' history-search-forward
bindkey "^A" beginning-of-line
bindkey "^E" end-of-line
PS1='%2~> '
setopt prompt_subst
# git theming default: Variables for theming the git info prompt
ZSH_THEME_GIT_PROMPT_PREFIX="(" # Prefix at the very beginning of the prompt, before the branch name
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
(( count = $count + 1 ))
done
PR_NO_COLOUR="%{$terminfo[sgr0]%}"
function precmd() {
head_info=$(git symbolic-ref HEAD 2> /dev/null)
rvm_prompt_info=$(~/.rvm/bin/rvm-prompt 2> /dev/null)
rvm_flag=$rvm_prompt_info
RPROMPT='$PR_RED$rvm_flag$PR_NO_COLOUR'
if [[ $head_info =~ '^refs*' ]]; then
branch_name=${head_info##refs/heads/}
output=$(git diff-files --exit-code --quiet)
if [[ $? == 0 ]]; then
PROMPT='%2~ $PR_RED$ZSH_THEME_GIT_PROMPT_PREFIX$PR_NO_COLOUR$PR_BLUE$branch_name$PR_NO_COLOUR$PR_RED$ZSH_THEME_GIT_PROMPT_SUFFIX$PR_NO_COLOUR$PR_CYAN>$PR_NO_COLOUR '
else
PROMPT='%2~ $PR_RED$ZSH_THEME_GIT_PROMPT_PREFIX$PR_NO_COLOUR$PR_BLUE$branch_name$PR_NO_COLOUR$PR_RED$ZSH_THEME_GIT_PROMPT_SUFFIX$PR_NO_COLOUR$PR_MAGENTA*$PR_NO_COLOUR '
fi
else
PROMPT='%2~~>'
fi
}
xsource() {
if (( ${#argv} < 1 )) ; then
printf 'usage: xsource FILE(s)...\n' >&2
return 1
fi
while (( ${#argv} > 0 )) ; do
[[ -r "$1" ]] && source "$1"
shift
done
return 0
}
function zrclocal() {
xsource "/etc/zsh/zshrc.local"
xsource "${HOME}/.zshrc.local"
return 0
}
#history stuff
## Command history configuration
HISTFILE=$HOME/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt histignoredups
setopt APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_SPACE
setopt HIST_NO_STORE
setopt HIST_VERIFY
setopt EXTENDED_HISTORY
setopt HIST_SAVE_NO_DUPS
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_FIND_NO_DUPS
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data
setopt hist_verify
setopt inc_append_history
setopt extended_history
setopt hist_expire_dups_first
# Allow [ or ] whereever you want
unsetopt nomatch
# completion related stuff
## fixme - the load process here seems a bit bizarre
setopt noautomenu
setopt complete_in_word
setopt always_to_end
unsetopt flowcontrol
unsetopt nomatch
WORDCHARS=''
autoload -U compinit
compinit
zmodload -i zsh/complist
## case-insensitive (all),partial-word and then substring completion
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
unset CASE_SENSITIVE
else
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
fi
zstyle ':completion:*' list-colors ''
unsetopt MENU_COMPLETE
#setopt AUTO_MENU
# should this be in keybindings?
bindkey -M menuselect '^o' accept-and-infer-next-history
zstyle ':completion:*:*:*:*:*' menu yes select
# zstyle ':completion:*:*:*:*:processes' force-list always
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
# Load known hosts file for auto-completion with ssh and scp commands
if [ -f ~/.ssh/known_hosts ]; then
zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`
fi
#end of completion related stuff
# Aliases
alias g='git'
alias gst='git status -sb'
alias gl='git pull'
alias gup='git fetch && git rebase'
alias gp='git push'
alias gd='git diff | subl'
alias gdv='git diff -w "$@" | vim -R -'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gcount='git shortlog --summary --numbered --all | cat -n'
alias gcp='git cherry-pick'
alias grst='git reset --hard HEAD'
alias gf="git fetch"
alias s="sake"
alias be="bundle exec"
alias remigrate='rake db:migrate && rake db:migrate:redo && rake db:schema:dump db:test:prepare'
alias ip='curl -s http://ip-api.com/json | jq'
alias dns='curl -sL http://edns.ip-api.com/json | jq'
alias a='ls -lart'
alias v='mvim .'
alias bu='brew update && brew upgrade && brew cleanup'
alias psr="ps axu|grep ruby"
alias ..2="cd ../.."
alias ..3="cd ../../.."
alias r="bundle exec rake"
alias screen="screen -h 5000"
alias ls="ls -G"
alias away='/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend'
export EDITOR="vim"
export PGHOST=localhost
export PATH=/usr/local/bin:$HOME/bin:/usr/local/sbin:$PATH
fpath=(/usr/local/share/zsh-completions $fpath)
#export JRUBY_OPTS=--1.9
# Oracle specific
#export DYLD_LIBRARY_PATH="/usr/local/oracle/instantclient_10_2"
#export SQLPATH="/usr/local/oracle/instantclient_10_2"
#export TNS_ADMIN="/usr/local/oracle/network/admin"
#export NLS_LANG="AMERICAN_AMERICA.UTF8"
#export PATH=$PATH:$DYLD_LIBRARY_PATH
#export TORQUEBOX_HOME=/opt/torquebox
#export JBOSS_HOME=$TORQUEBOX_HOME/jboss
# added by travis gem
[ -f /Users/arunagw/.travis/travis.sh ] && source /Users/arunagw/.travis/travis.sh
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=es_US.UTF-8
export LC_NUMERIC=es_US
export LC_TIME=es_US
export LC_COLLATE=es_US.UTF-8
export LC_MONETARY=es_US
export LC_MESSAGES=es_US
export LC_PAPER=es_US
export LC_NAME=es_US
export LC_ADDRESS=es_US
export LC_TELEPHONE=es_US
export LC_MEASUREMENT=es_US
export LC_IDENTIFICATION=es_US
export GOPATH=$HOME/go-code
export PATH=$PATH:$GOPATH/bin
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/arunagw/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
export DISABLE_SPRING=true
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
eval "$(hub alias -s)"
eval "$(rbenv init -)"
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
zrclocal