summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-12-03 17:24:40 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-12-03 17:24:40 +0000
commite5ddd5b62f794e262119053c367ab66eca678475 (patch)
treee568f1138213f02b04e2e0662d6df5a623447696 /Completion/Unix/Command
parentd7f01887d51360b7149182b8fe8fc4d8d14bde36 (diff)
downloadzsh-e5ddd5b62f794e262119053c367ab66eca678475.tar.gz
zsh-e5ddd5b62f794e262119053c367ab66eca678475.zip
28468: allow man page completion for files when / is present
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_man16
1 files changed, 14 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index a3a4d4796..d1346f7cc 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -86,6 +86,18 @@ _man() {
_man_pages() {
local matcher pages dummy sopt
+ # What files corresponding to manual pages can end in.
+ local suf='.((?|<->*)(|.gz|.bz2|.Z|.lzma))'
+
+ if [[ $PREFIX$SUFFIX = */* ]]; then
+ # Easy way to test for versions of man that allow file names.
+ # This can't be a normal man page reference.
+ # Try to complete by glob first.
+ _path_files -g "*$suf" && return
+ _path_files
+ return
+ fi
+
zparseopts -E M+:=matcher
if (( $#matcher )); then
@@ -109,9 +121,9 @@ _man_pages() {
if ((CURRENT > 2)) ||
! zstyle -t ":completion:${curcontext}:manuals.$sect" insert-sections
then
- compadd "$@" - ${pages%.((?|<->*)(|.gz|.bz2|.Z|.lzma))}
+ compadd "$@" - ${pages%$~suf}
else
- compadd "$@" -P "$sopt$sect " - ${pages%.((?|<->*)(|.gz|.bz2|.Z|.lzma))}
+ compadd "$@" -P "$sopt$sect " - ${pages%$~suf}
fi
}