about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-01-14 15:37:43 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-01-18 02:40:02 +0000
commit896f43c72bcfd3f1e2240f54609868634a3c4e45 (patch)
tree82ba8cd93a9e8e176d75355a2fc06242d7d92016
parent35b8e8794f00987b4b9380f5f20f6ca6ec64b7c3 (diff)
downloadzsh-896f43c72bcfd3f1e2240f54609868634a3c4e45.tar.gz
zsh-896f43c72bcfd3f1e2240f54609868634a3c4e45.tar.xz
zsh-896f43c72bcfd3f1e2240f54609868634a3c4e45.zip
37634: _man: Support subsection names such as '3p'.
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_man4
2 files changed, 5 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 72acb9123..d64e2c121 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2016-01-18  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
+	* 37634: Completion/Unix/Command/_man: _man: Support subsection
+	names such as '3p'.
+
 	* 37634: Completion/Unix/Command/_man: _man: Disentangle a local
 	variable that had two distinct semantics. No functional change
 
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 871af4854..0534db753 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -52,7 +52,7 @@ _man() {
   fi
 
   if [[ $sect = (<->*|1M|l|n) || $sect = \(*\|*\) ]]; then
-    dirs=( $^_manpath/(sman|man|cat)${~sect}/ )
+    dirs=( $^_manpath/(sman|man|cat)${~sect%%[^0-9]#}/ )
     awk="\$2 == \"$sect\" {print \$1}"
   else
     dirs=( $^_manpath/(sman|man|cat)*/ )
@@ -111,7 +111,7 @@ _man_pages() {
   fi
 
   pages=( ${(M)dirs:#*$sect_dirname/} )
-  compfiles -p pages '' '' "$matcher" '' dummy "*"
+  compfiles -p pages '' '' "$matcher" '' dummy "*${(b)sect}*"
   pages=( ${^~pages}(N:t) )
 
   (($#mrd)) && pages[$#pages+1]=($(awk $awk $mrd))