Create a gist now

Instantly share code, notes, and snippets.

@coredump /zshrc Secret
Created Mar 1, 2012

What would you like to do?
# Preferred utilities:
export EDITOR=`which vim`
export VISUAL="$EDITOR"
# Local aliases stored separately for easy reloading:
. ~/.aliases
# If running interactively:
if [ "$PS1" ]; then
# Colour stuff:
eval `dircolors -b`
alias ls='ls --color=auto --classify --ignore=",,*"'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Changes terminal windows title to current dir
function chpwd {
[[ -t 1 ]] || return
case $TERM in
sun-cmd) print -Pn "\e]l%~\e\\"
;;
*xterm*|rxvt|(dt|k|E)term) print -Pn "\e]2;%~\a"
;;
esac
}
# Needed for the prompt
autoload -Uz vcs_info
zstyle ':vcs_info:git*' formats " (%b)%u%c"
zstyle ':vcs_info:git*' unstagedstr '*'
zstyle ':vcs_info:git*' stagedstr '+'
zstyle ':vcs_info:*' check-for-changes true
function precmd {
psvar=()
vcs_info
if [ -n $vcs_info_msg_0_ ]
then
psvar[1]="$vcs_info_msg_0_ "
else
psvar[1]=' '
fi
}
# Prompt Madness
# Allows prompt to update variables from the vcs_info precmd
export PROMPT="%B%F{green}%n@%m%f:%F{blue}%~%f%b%F{yellow}%1v%f%B%#%b "
# whois options:
# Skip license crap.
export WHOIS_HIDE=1
# Keybindings:
# Emacs keybinding mode for bash-like behaviour.
bindkey -A emacs main
# Keys
bindkey '' emacs-backward-word # Ctrl+LeftArrow
bindkey '' emacs-forward-word # Ctrl+RightArrow
bindkey "^[[1~" vi-beginning-of-line # Home
bindkey "^[[4~" vi-end-of-line # End
bindkey '^[[3~' delete-char # Del
bindkey '^[[5~' vi-backward-blank-word # Page Up
bindkey '^[[6~' vi-forward-blank-word # Page Down
# Options:
# Don't HUP me bro
setopt nohup
# Automatically update pushd/popd list...
setopt autopushd
# ... and don't duplicate them.
setopt pushdignoredups
# Show types in completion.
setopt listtypes
# Also make equals safe to use. Never even knew about that.
setopt noequals
# Tell me if a command fails.
setopt printexitvalue
# Notify me if something takes awhile.
REPORTTIME=1
# History options:
# Lines to keep, lines to save, where to save...
HISTSIZE=10000
SAVEHIST=$HISTSIZE
HISTFILE=~/.zsh_history
# ... but append, don't overwrite, and do it incrementally.
setopt incappendhistory
# Don't append duplicates.
setopt histignoredups
# Ignore lines that begin with a space
setopt histignorespace
# Completion:
# Enable completion.
autoload -U compinit && compinit
# Load coloured completion.
zmodload zsh/complist 2> /dev/null
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# Cache completions.
mkdir -p /tmp/$LOGNAME/zshcompl
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path /tmp/$LOGNAME/zshcompl
# Remove some chars from 'words' (e.g. alt-backspace) that I like.
# Essentially, add them as word delimiters.
# Currently: . /
WORDCHARS=${WORDCHARS:s,/,,}
WORDCHARS=${WORDCHARS:s,.,,}
# rbenv:
export PATH="$HOME/.rbenv/bin:$PATH"
eval "`rbenv init - zsh`"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment