zshrc.d/15-completion.zrc
author Mikael Berthe <mikael@lilotux.net>
Mon, 02 Mar 2020 13:16:10 +0100
changeset 44 157f894ef9f7
parent 35 c6d405e0684b
permissions -rw-r--r--
Add some quotes and double brackets...


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

# From Debian' system zshrc
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
                                           /usr/local/bin  \
                                           /usr/sbin       \
                                           /usr/bin        \
                                           /sbin           \
                                           /bin            \
                                           /usr/X11R6/bin

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