d27c85fbe1
Fixes several issues in the current `man(1)` completion: - _section_ numbers are not stripped off - _Perl Programmers Reference Guide_ (`3p`) section is ignored - manual page name can only be completed as the 1st argument While there, add several more manual page hierarchies, i.e. `cat*` for _graphiz_ on OpenBSD, `/usr/local/share/man` on macOS, etc.
12 lines
313 B
Bash
Executable File
12 lines
313 B
Bash
Executable File
#: | man | man pages |
|
|
MAN_CACHE=$LOAD_PATH/cache/man
|
|
if [ ! -f $MAN_CACHE ]; then
|
|
mkdir -p $(dirname ${MAN_CACHE})
|
|
for i in /usr{,/X11R6,/local}{,/share}/man/{,cat,man}[1-9lnp]{,f,p}
|
|
do
|
|
test -d $i && ls $i
|
|
done | rev | cut -d. -f2- | rev | sort -u > $MAN_CACHE
|
|
fi
|
|
|
|
set -A complete_man -- $(cat $MAN_CACHE)
|