fish-shell/share/functions/__fish_complete_man.fish
axel 343cafef34 Redo installation file structure, move lots of things to $PREFIX/share/fish
darcs-hash:20060217101339-ac50b-d93d2c620a4b7f75f05ff461a6edbee001da7613.gz
2006-02-17 20:13:39 +10:00

28 lines
545 B
Fish

function __fish_complete_man
if test (commandline -ct)
# Try to guess what section to search in. If we don't know, we
# use [^)]*, which should match any section
set section ""
set prev (commandline -poc)
set -e prev[1]
while count $prev
switch $prev[1]
case '-**'
case '*'
set section $prev[1]
end
set -e prev[1]
end
set section $section"[^)]*"
# Do the actual search
apropos (commandline -ct) | grep \^(commandline -ct) | sed -n -e 's/\([^ ]*\).*(\('$section'\)) *- */\1\t\2: /p'
end
end