Shell: Cleanup Zsh completion on custom pacman functions

master
Pierre Neidhardt 2016-06-11 20:09:32 +02:00
parent 69999c95c0
commit cdd45aa94a
3 changed files with 11 additions and 20 deletions

View File

@ -4,36 +4,30 @@
## Let's check if pacman completion is already loaded. If not, we parse the
## pacman completion file.
if [ -n "$(type _pacman_action_none | grep "not found")" ]; then
if [ $(type _pacman_action_none | grep -c "not found") -gt 0 ]; then
source "/usr/share/zsh/site-functions/_pacman"
fi
_pcc () {
case $words[1] in
pacfiles)
_pacman_action_query
return ;;
pql)
_pacman_action_query
return ;;
pacsize)
case $words[2] in
-*q*)
_pacman_action_query
return ;;
-)
return 1;;
-*)
return 1 ;;
*)
_pacman_action_sync
return ;;
esac
return ;;
*)
_pacman_action_sync
return 1
;;
case $words[2] in
-*)
return 1 ;;
*)
_pacman_action_query
return ;;
esac
return ;;
esac
}

View File

@ -6,12 +6,10 @@ if [ "zsh" = "$SHELL_CURRENT" ]; then
compdef _gs pdfcompress
compdef _gs pdfextract
compdef _gs pdfresize
compdef _pacman pacman-color
compdef _pcc pacfiles
compdef _pcc pacsize
compdef _pcc pql
compdef _tex ltx
compdef _path_commands typex
compdef _pspdf zat
compdef _pcc abs-wrapper
fi

View File

@ -64,7 +64,6 @@ setopt pushdminus
## Completion
## Custom completion
## TODO: this is quite slow. Why?
fpath=(~/.shell.d/completion $fpath)
autoload -Uz compinit