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 ## Let's check if pacman completion is already loaded. If not, we parse the
## pacman completion file. ## 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" source "/usr/share/zsh/site-functions/_pacman"
fi fi
_pcc () { _pcc () {
case $words[1] in case $words[1] in
pacfiles)
_pacman_action_query
return ;;
pql)
_pacman_action_query
return ;;
pacsize) pacsize)
case $words[2] in case $words[2] in
-*q*) -*)
_pacman_action_query return 1 ;;
return ;;
-)
return 1;;
*) *)
_pacman_action_sync _pacman_action_sync
return ;; return ;;
esac esac
return ;; return ;;
*) *)
_pacman_action_sync case $words[2] in
return 1 -*)
;; return 1 ;;
*)
_pacman_action_query
return ;;
esac
return ;;
esac esac
} }

View File

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

View File

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