You are not logged in.
Pages: 1
Sorry to post such a trivial topic, but the irc channel was unfortunately less than helpful.
I would like to have man pages tab complete, e.g. 'man pac\t' -> 'man pacman'.
I do NOT want bash-completion. It is bloated, unnecessary, and contrary to my notion of the Arch Way. Unfortunately, documentation for the completion mechanism itself is scarce, and usually only shows how to do filetype completion. Google has not helpful, this forum recommends the bash-completion package. I have looked at the package itself to look for the pertinent function or command. Grepping for man, manpage, manual was unsuccessful, and the pertinent command is not readily apparent.
Last edited by egan (2010-02-07 23:13:25)
Offline
It's in the file /etc/bash_completion.d/man. The actual function is called '_man', and it is enabled by the line:
complete -F _man $filenames man apropos whatis
However, the _man function itself calls a bunch of other functions that are part of the overall package. These do things like determine the word before the cursor that you hit TAB on, or expanding the list of matching entries, etc. It may not be so easy to isolate, unfortunately.
Offline
File completion should be good enough an example as you're replacing the list of files with a list of man pages - which are files in (below) a specific directory. Basically you need to write a function that returns the list of possibilities - which will be a list of man pages in this case.
There's a good example (of the general mechanism) at this page http://www.debian-administration.org/ar … ion_part_2 as well as in books like "Learning The Bash Shell" by O'reilly. The man page also covers it (search for "Programmable Completion").
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Thanks for the replies guys, they were informative. At least now I know what to look into.
Offline
Pages: 1