about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/User/_perl_basepods4
-rw-r--r--Completion/User/_perl_builtin_funcs4
-rw-r--r--Completion/User/_perl_modules7
-rw-r--r--Completion/User/_perldoc35
4 files changed, 28 insertions, 22 deletions
diff --git a/Completion/User/_perl_basepods b/Completion/User/_perl_basepods
index f4e70382b..2dc0874f0 100644
--- a/Completion/User/_perl_basepods
+++ b/Completion/User/_perl_basepods
@@ -27,4 +27,6 @@ if [[ ${+_perl_basepods} -eq 0 ]]; then
   fi
 fi
 
-compadd - $_perl_basepods
+local expl
+_description expl "Perl base pods"
+compadd "$expl[@]" - $_perl_basepods
diff --git a/Completion/User/_perl_builtin_funcs b/Completion/User/_perl_builtin_funcs
index f7fcae883..804488db9 100644
--- a/Completion/User/_perl_builtin_funcs
+++ b/Completion/User/_perl_builtin_funcs
@@ -26,4 +26,6 @@ if [[ ${+_perl_builtin_funcs} -eq 0 ]]; then
   fi
 fi
 
-compadd - $_perl_builtin_funcs
+local expl
+_description expl "Perl built-in functions"
+compadd "$expl[@]" - $_perl_builtin_funcs
diff --git a/Completion/User/_perl_modules b/Completion/User/_perl_modules
index c909055ba..f43ec8889 100644
--- a/Completion/User/_perl_modules
+++ b/Completion/User/_perl_modules
@@ -1,6 +1,5 @@
 #compdef pmpath pmvers pmdesc pmload pmexp pmeth pmls pmcat pman pmfunc podgrep podtoc podpath
 #
-#
 # _perl_modules - zsh completion function
 #
 # Adam Spiers <adam@spiers.net>
@@ -8,8 +7,6 @@
 # Calculate all installed Perl modules.  The result is cached
 # for future use.
 #
-# Bugs:
-#   - can't cope with multiple installs of Perl
 
 # Change this if you have pminst and want to use it.  The zsh code
 # actually produces better results because pminst misses modules of
@@ -44,4 +41,6 @@ if [[ ${+_perl_modules} -eq 0 ]]; then
   fi
 fi
 
-compadd - $_perl_modules
+local expl
+_description expl "Perl modules"
+compadd "$expl[@]" - $_perl_modules
diff --git a/Completion/User/_perldoc b/Completion/User/_perldoc
index d15650448..acd772b00 100644
--- a/Completion/User/_perldoc
+++ b/Completion/User/_perldoc
@@ -1,23 +1,26 @@
 #compdef perldoc
 #
-#
 # _perldoc - zsh completion function for perldoc
 #
 # Adam Spiers <adam@spiers.net>
 #
-# Behaviour should be roughly equivalent to:
-# compctl -k perl_modules -k perl_basepods -f 
-#           -x 'c[-1,-f]' -k perl_funcs --
-#	  + -k man_pages
-#     perldoc
 
-if [[ $CURRENT -eq 3 && $words[2] == '-f' ]]; then
-  _perl_builtin_funcs
-elif [[ $CURRENT -eq 3 && $words[2] == '-q' ]]; then
-  zle -R "I can't read your mind!"
-  return 1
-else
-  _perl_modules
-  _perl_basepods
-  _path_files -/ -g '*.(pod|pm)'
-fi
+_perldoc () {
+    _arguments -s \
+        '-h:help:' \
+        '(-q)-f:Perl built-in function:_perl_builtin_funcs:*:' \
+        '(-f)-q:Perl FAQ keyword:' \
+        '*:Perl pod pages:_perl_pods'
+}
+
+_perl_pods () {
+    local nm="$compstate[nmatches]"
+
+   _perl_modules
+   _perl_basepods
+   _path_files -J 'Perl modules and .pods' -/ -g '*.(pod|pm)'
+
+    [[ nm -ne "$compstate[nmatches]" ]]
+}
+
+_perldoc "$@"