zshrc.d/15-completion.zrc
author Mikael Berthe <mikael@lilotux.net>
Sun, 15 Jul 2012 15:57:45 +0200
changeset 13 e1da4a7a9e92
child 35 c6d405e0684b
permissions -rw-r--r--
More modularization


compctl -g '.*(-/) *(-/)' cd pushd
compctl -g '.*(-/) *(-/)' rmdir
compctl -g '*.Z *.z *.gz *.tgz *(-/)' zcat gunzip
compctl -g '*.Z *.z *.gz *.tgz *.tar *.bz2 *(-/)' tart tarx tar
compctl -g '*.bz2 *(-/)' bz2cat bunzip2
compctl -g '*.zip *.ZIP *.exe *.EXE *(-/)' unzip
compctl -g '*.ps *.ps.gz *(-/)' gs ghostview gv evince
compctl -g '*.tex* *.latex* *(-/)' tex latex texi2dvi
compctl -g '*.dvi *(-/)' xdvi dvips
compctl -j -P % -x 's[-] p[1]' -k signals -- kill
compctl -l '' nohup exec
compctl -u -x 's[@]' -k hosts -- finger
compctl -m info
compctl -m -g '*.1 *(-/)' man
compctl -c which where type
compctl -g '*.pdf *(-/)' evince

# Hosts completion

if [ -f ~/.ssh/config ]; then
  hosts=($hosts `grep ^Host ~/.ssh/config | sed s/Host\ // | egrep -v '^\*$'`)
fi
if [ "$hosts" ]; then
  zstyle ':completion:*:hosts' hosts $hosts
fi


zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' completions 1
zstyle ':completion:*' format 'Completing %B%d%b%:'
zstyle ':completion:*' glob 1
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' max-errors 2 numeric
zstyle ':completion:*' menu select=3
zstyle ':completion:*' prompt '%e erreur(s)...'
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
zstyle ':completion:*' substitute 1

autoload -Uz compinit
compinit

# Needed for menuselect below
zmodload zsh/complist

autoload -U incremental-complete-word
zle -N incremental-complete-word
bindkey 'i' incremental-complete-word

bindkey -M menuselect '' accept-and-infer-next-history