From cdd45aa94a9cf43fd7fe6a58e6d2e5b4ce04dcba Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Sat, 11 Jun 2016 20:09:32 +0200 Subject: [PATCH] Shell: Cleanup Zsh completion on custom pacman functions --- .shell.d/completion/_pcc | 28 +++++++++++----------------- .shell.d/completion_rc | 2 -- .shell.d/options_zsh | 1 - 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/.shell.d/completion/_pcc b/.shell.d/completion/_pcc index 47c2e820..78f289a4 100644 --- a/.shell.d/completion/_pcc +++ b/.shell.d/completion/_pcc @@ -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 } diff --git a/.shell.d/completion_rc b/.shell.d/completion_rc index 530ea8da..14535404 100644 --- a/.shell.d/completion_rc +++ b/.shell.d/completion_rc @@ -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 diff --git a/.shell.d/options_zsh b/.shell.d/options_zsh index cc8197da..dd77a3a8 100644 --- a/.shell.d/options_zsh +++ b/.shell.d/options_zsh @@ -64,7 +64,6 @@ setopt pushdminus ## Completion ## Custom completion -## TODO: this is quite slow. Why? fpath=(~/.shell.d/completion $fpath) autoload -Uz compinit