From e5ddd5b62f794e262119053c367ab66eca678475 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 3 Dec 2010 17:24:40 +0000 Subject: 28468: allow man page completion for files when / is present --- Completion/Unix/Command/_man | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Completion') 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 } -- cgit 1.4.1