Skip to content

Instantly share code, notes, and snippets.

@sdiehl
Created December 11, 2010 18:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdiehl/737525 to your computer and use it in GitHub Desktop.
Save sdiehl/737525 to your computer and use it in GitHub Desktop.
export EDITOR=vim
set -o vi
zstyle :compinstall filename '/home/stephen/.zshrc'
autoload -Uz compinit
compinit
setopt AUTO_CD # cd if no matching command
setopt AUTO_PARAM_SLASH # adds slash at end of tabbed dirs
setopt CHECK_JOBS # check bg jobs on exit
setopt CORRECT # corrects spelling
setopt CORRECT_ALL # corrects spelling
setopt EXTENDED_GLOB # globs #, ~ and ^
setopt EXTENDED_HISTORY # saves timestamps on history
setopt GLOB_DOTS # find dotfiles easier
setopt HASH_CMDS # save cmd location to skip PATH lookup
setopt HIST_EXPIRE_DUPS_FIRST # expire duped history first
setopt HIST_NO_STORE # don't save 'history' cmd in history
setopt INC_APPEND_HISTORY # append history as command are entered
setopt LIST_ROWS_FIRST # completion options left-to-right, top-to-bottom
setopt LIST_TYPES # show file types in list
setopt MARK_DIRS # adds slash to end of completed dirs
setopt NUMERIC_GLOB_SORT # sort numerically first, before alpha
setopt PROMPT_SUBST # sub values in prompt (though it seems to work anyway haha)
setopt RM_STAR_WAIT # pause before confirming rm *
setopt SHARE_HISTORY # share history between open shells
# Aliases
alias ls="ls --color -h"
alias screen="screen -q"
alias myip="/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'"
# Git stuff
alias gst='git status'
alias gl='git pull origin $(parse_git_branch)'
alias glr='git pull --rebase origin $(parse_git_branch)'
alias gp='git push origin $(parse_git_branch)'
alias gd='git diff | meld'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gr="git reset --hard HEAD"
alias grn="git log --format=oneline --abbrev-commit --no-merges"
###
# get the name of the branch we are on
###
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
# Tab completion
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
## Completion for processes
[ "$USER" = "root" ] && SWITCH='-A' || SWITCH="-u ${USER}"
zstyle ':completion:*:processes-names' command \
"ps c $SWITCH -o command | uniq"
zstyle ':completion:*:processes' command \
"ps c $SWITCH -o pid -o command | uniq"
unset SWITCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment