Created
June 7, 2012 00:15
-
-
Save jself/2885677 to your computer and use it in GitHub Desktop.
My .zshrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#init compinit, colors | |
autoload -Uz compinit; compinit | |
autoload -U colors && colors | |
#options | |
setopt inc_append_history | |
setopt share_history | |
setopt autopushd pushdminus pushdsilent pushdtohome | |
setopt auto_menu | |
setopt complete_in_word | |
setopt always_to_end | |
#autocompletion options | |
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' | |
zstyle ':completion:*' list-colors '' | |
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' | |
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w" | |
zstyle ':completion:*:*:*:*:*' menu select | |
#global exports/aliases | |
HISTFILE=$HOME/.zsh_history | |
HISTSIZE=10000 | |
SAVEHIST=10000 | |
export PATH=$HOME/bin:/usr/local/bin:/usr/local/sbin/:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games | |
export BROWSER=`which google-chrome` | |
alias dh='dirs -v' | |
alias gs='git status -s' | |
#host specific exports/settings/aliases | |
if [[ "$HOST" == "jeremy-workvm" ]]; then | |
EDITOR=vim | |
alias py='django-admin.py shell' | |
alias dbshell='django-admin.py dbshell' | |
alias cdh='cd /home/jself/devel/cms_dev/src' | |
export PYTHONPATH=/home/jself/lib:$PYTHONPATH | |
export PATH=/home/jself/devel/cms_dev/bin:/home/jself/bin:$PATH | |
export CMG_DB_PORT=5432 | |
activate() { | |
#source /home/jself/jellydoughnut/three_venv.sh | |
source /home/jself/devel/cms_dev/bin/activate | |
cd /home/jself/devel/cms_dev/src | |
} | |
activate | |
fi | |
if [[ "`uname`" == "Darwin" ]]; then | |
#alias gvim="/Applications/MacVim.app/Contents/MacOS/MacVim -g &" | |
function gvim { /Applications/MacVim.app/Contents/MacOS/Vim -g $*; } | |
export EPREFIX="$HOME/Library/Gentoo" | |
export PATH="$EPREFIX/usr/lib/portage/bin:$EPREFIX/usr/portage/scripts:$EPREFIX/usr/lib/postgresql-9.0/bin:$EPREFIX/usr/bin:$EPREFIX/bin:$EPREFIX/tmp/usr/bin:$EPREFIX/tmp/bin:$PATH" | |
export CHOST="x86_64-apple-darwin10" | |
export PGDATA="$EPREFIX/etc/postgresql-9.0" | |
alias activate="source /Users/jself/devel/cms_dev/bin/activate" | |
alias ls="ls --color=auto" | |
export PGPORT=5556 | |
export CMG_DB_PORT=5556 | |
export DYLD_FALLBACK_LIBRARY_PATH=/Users/jself/Library/Gentoo/usr/lib | |
alias man="/usr/bin/man" | |
gr() { | |
A="$*" | |
$A | |
growlnotify -m "$A finished with exit code $?" | |
} | |
alias gr="growlrun" | |
export LANG=en_US.UTF-8 | |
export LOCALE=en_US.UTF-8 | |
export TERM=ansi | |
fi | |
if [[ "`hostname`" == "shadowstar" ]]; then | |
LANG="en_US.UTF-8" | |
if [ -n "$DISPLAY" ]; then | |
BROWSER=chromium | |
fi | |
fi | |
#virtualenv info | |
VEW=`which virtualenvwrapper.sh` | |
if [[ "$?" == "0" ]]; then | |
source $VEW | |
fi | |
#binds | |
bindkey -v | |
# Make sure Ctrl-R works | |
bindkey '^R' history-incremental-search-backward | |
# Make backspace work like vim | |
bindkey '^?' backward-delete-char | |
# When using arrows, match what I have already typed | |
# for history search | |
bindkey -M viins "\e[A" history-search-backward | |
bindkey -M viins "\e[B" history-search-forward # Down arrow | |
bindkey -M vicmd "k" up-line-or-search | |
bindkey -M vicmd "j" up-line-or-search | |
#show hostname if on ssh | |
if [ -n "$SSH_CLIENT" ]; then | |
SSH_STR="(%{$fg_bold[blue]%}$(hostname)${RPROMPT}%{$reset_color%})" | |
else | |
SSH_STR="" | |
fi | |
autoload -Uz vcs_info | |
zstyle ':vcs_info:*' stagedstr '%F{11}●' | |
zstyle ':vcs_info:*' unstagedstr '%F{1}●' | |
zstyle ':vcs_info:*' check-for-changes true | |
# zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' | |
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%F{1}:%F{11}%r' | |
zstyle ':vcs_info:*' enable git svn | |
precmd () { | |
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { | |
zstyle ':vcs_info:*' formats ' %F{blue}[%F{green}%b%c%u%F{blue}]' | |
} else { | |
zstyle ':vcs_info:*' formats ' %F{blue}[%F{green}%b%c%u%F{yellow}●%F{blue}]' | |
} | |
vcs_info | |
} | |
setopt prompt_subst | |
#vi indicator mode | |
INSERT="%{$fg_bold[green]%}➜" | |
CMD="%{$fg_bold[red]%}➜" | |
VIMODE="${INSERT}" | |
function zle-line-init zle-keymap-select { | |
VIMODE="${${KEYMAP/vicmd/${CMD}}/(main|viins)/${INSERT}}" | |
zle reset-prompt | |
} | |
zle -N zle-line-init | |
zle -N zle-keymap-select | |
vcs_info | |
PROMPT="\$VIMODE${reset_color}${SSH_STR}%{$fg_bold[green]%}%p %{$fg[cyan]%}%2c\${vcs_info_msg_0_}%{$fg_bold[blue]%}%{$fg_bold[blue]%} %{$reset_color%}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment