Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
266 lines (212 sloc) 7.73 KB
# Path to your oh-my-zsh installation.
export ZSH=/Users/sean/.oh-my-zsh
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=()
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
source $ZSH/oh-my-zsh.sh
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
export LSCOLORS=exfxcxdxbxegedabagacad
# Turn off sharing history amongst zsh instances
setopt no_share_history
###
### Prompt
###
__GIT_PROMPT_DIR="/Users/sean/bin"
## Hook function definitions
function chpwd_update_git_vars() {
update_current_git_vars
}
function preexec_update_git_vars() {
case "$2" in
git*|hub*|gh*|stg*)
__EXECUTED_GIT_COMMAND=1
;;
esac
}
function precmd_update_git_vars() {
if [ -n "$__EXECUTED_GIT_COMMAND" ] || [ ! -n "$ZSH_THEME_GIT_PROMPT_CACHE" ]; then
update_current_git_vars
unset __EXECUTED_GIT_COMMAND
fi
}
chpwd_functions+=(chpwd_update_git_vars)
precmd_functions+=(precmd_update_git_vars)
preexec_functions+=(preexec_update_git_vars)
## Function definitions
function update_current_git_vars() {
unset __CURRENT_GIT_STATUS
local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
_GIT_STATUS=$(python ${gitstatus} 2>/dev/null)
__CURRENT_GIT_STATUS=("${(@s: :)_GIT_STATUS}")
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
GIT_AHEAD=$__CURRENT_GIT_STATUS[2]
GIT_BEHIND=$__CURRENT_GIT_STATUS[3]
GIT_STAGED=$__CURRENT_GIT_STATUS[4]
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[5]
GIT_CHANGED=$__CURRENT_GIT_STATUS[6]
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7]
}
git_super_status() {
precmd_update_git_vars
if [ -n "$__CURRENT_GIT_STATUS" ]; then
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
if [ "$GIT_BEHIND" != "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND$GIT_BEHIND%{${reset_color}%}"
fi
if [ "$GIT_AHEAD" != "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD$GIT_AHEAD%{${reset_color}%}"
fi
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
if [ "$GIT_STAGED" != "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED%{${reset_color}%}"
fi
if [ "$GIT_CONFLICTS" != "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
fi
if [ "$GIT_CHANGED" != "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED%{${reset_color}%}"
fi
if [ "$GIT_UNTRACKED" != "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
fi
if [ "$GIT_CHANGED" != "0" ] && [ "$GIT_CONFLICTS" != "0" ] && [ "$GIT_STAGED" != "0" ] && [ "$GIT_UNTRACKED" != "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
echo "$STATUS"
fi
}
# Set the prompt.
RPROMPT='$(git_super_status)'
ZSH_THEME_GIT_PROMPT_PREFIX="git:"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_SEPARATOR=" "
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg[yellow]%}"
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[yellow]%}%{✗%G%}"
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{x%G%}"
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[yellow]%}%{+%G%}"
ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[yellow]%}%{↓%G%}"
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[yellow]%}%{↑%G%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}%{?%G%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[yellow]%}%{✔%G%}"
PROMPT='%{$fg[yellow]%}➜ %{$fg[cyan]%}%C%{$reset_color%} '
###
### aliases
###
alias fucking=sudo
alias fu=sudo
alias vi=vim
# directory movement aliases
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias add='git add'
alias amend='git amend'
alias branches='git branches'
alias ci='git ci'
alias co='git co'
alias di='git diff'
alias diw='git diw'
alias fetch='git fetch'
alias log='git log'
alias merge='git merge'
alias pom='git pom'
alias pull='git pull'
alias push='git push'
alias remote='git remote'
alias remotes='git remotes'
alias reset='git reset --hard'
alias snap='git snap'
alias st='git status'
alias tag='git tag'
alias tags='git tags'
alias upstream='git upstream'
alias e='emacsclient -n'
alias mkidr=mkdir
###
### environment variables
###
export GITHUB_USER=SeanTAllen
export CDPATH="$CDPATH:$HOME/code/ponylang:$HOME/code/sendence:$CDPATH:$HOME/code/"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home
###
### path
###
export PATH="$HOME/.rbenv/shims:$HOME/bin:/usr/local/share/python:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sbin:/usr/X11R6/bin"
###
### virtualenv for python
###
export WORKON_HOME=~/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
###
### Add fish style autosuggestions to zsh
### Aka make zsh usable to this old fish shell addict
###
### Must be sourced at the end of .zshrc
### zsh-syntax-highlighting.zsh wraps ZLE widgets. It must be sourced after
### all custom widgets have been created
### (i.e., after all zle -N calls and after running compinit). Widgets created
### later will work, but will not update the syntax highlighting.
###
### Currently requires autosuggest branch v0.1.x
###
source ~/.zsh/zsh-syntax-highlighting/
source ~/.zsh/zsh-autosuggestions/dist/autosuggestions.zsh
# Enable autosuggestions automatically.
zle -N zle-line-init autosuggest_start
# autosuggestions somehow breaks keybindings for history forward and back
# me rn: ¯\_(ツ)_/¯
bindkey '\e[A' history-beginning-search-backward
bindkey '\e[B' history-beginning-search-forward
# TODO: figure out why augosuggest breaks switch completion for commands.