Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: man compctl



> # completion for manpages

I wrote one that demands kind-of fast computers, but i was lazy:

#------------------------------------------------------------------------------
compctl -k "(- -a -d -F -l -r -t -M -T -s -k -f)" \
	-K compmanfull \
	-x "C[-1,-s^],s[-s]" -K compmansections \
	- "R[-f,;]" -f \
	- "R[-k,;]" -k "()" \
	- "R[-s,;]" -K compmansection \
	-- man

compmanfull() 
   { reply=(${^manpath}/man*/*(N:t:r)) }

compmansections() 
{  
   reply=( ${^manpath}/man*(N/) )
   reply=( ${reply##*/man} )
}

compmansection()
{
   local a
   read -Ac a
   echo $a | sed -ne 's/^.* -s\([^ ]*\).*$/\1/p' | read prefix
   reply=(${^manpath}/man$prefix/*(N:t:r))
}
#------------------------------------------------------------------------------



Messages sorted by: Reverse Date, Date, Thread, Author