Skip to content

Instantly share code, notes, and snippets.

@mgarriss
Created August 16, 2010 16:27
Show Gist options
  • Save mgarriss/527228 to your computer and use it in GitHub Desktop.
Save mgarriss/527228 to your computer and use it in GitHub Desktop.
autoload -U compinit
compinit
# use cache for slow completions
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
# fizzy match the completions
zstyle ':completion:*' completer _oldlist _complete _match _correct _approximate _prefix
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle -e ':completion:*:approximate:*' \
max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'
# ignore completions for commands i don't have
zstyle ':completion:*:functions' ignored-patterns '_*'
# complete process ids
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
# remove trailing slashes
zstyle ':completion:*' squeeze-slashes true
# don't complete on parent dir
zstyle ':completion:*:cd:*' ignore-parents parent pwd
# no idea what this does
xdvi() { command xdvi ${*:-*.dvi(om[1])} }
zstyle ':completion:*:*:xdvi:*' menu yes select
zstyle ':completion:*:*:xdvi:*' file-sort time
# bind to tab
bindkey '^i' expand-or-complete-prefix
if [ -f $HOME/.ssh/known_hosts ]; then
hosts=(${${${(f)"$(<$HOME/.ssh/known_hosts)"}%%\ }%%,*})
zstyle ':completion::hosts' hosts $hosts
fi
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' matcher-list '' '' 'r:|[._-]=* r:|=* l:|=*' '+'
zstyle ':completion:*' prompt '%e|'
zstyle :compinstall filename "$HOME/.zshrc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment