Hi,
I have been thinking how to make it easier to find the right commands
to use. In programs like Deskbar, MacOS Spotlight and Quicksilver,
the user types some words and sees a list of commands whose
descriptions match all the words as strings.
On the Unix shell, the command "apropos" (or "man -k") is used in the
reverse order. First you think: "I want a command that does X", then
realize that you should ask the apropos database, and type "apropos"
and the search terms. It may be easier if you can type the search
terms and then invoke the search, because you think of them before you
think of "apropos". This is a small step towards an object-verb order
of commands; the traditional order of Unix commands is verb-object.
I bound Alt+s to the a function that does this.
cat >> ~/.config/fish/fish_inputrc
"\M-s": apropos_words (commandline -po)
fish: Job 1, "cat >> ~/.config/fish/fish_inputrc " terminated by
signal SIGINT (Quit request from job control (^C))
function apropos_words -d "Find commands whose descriptions match all
the arguments"
if test $argv
set s
for w in $argv
set w (echo $w | tr -d '[:space:]')
if test $w
set s "$w|$s"
end
end
apropos -r "$s"
end
end
But it would be nice to paginate the output it is too big. Any ideas
how this can be done (elegantly)? I can use the "more" command but
this requires the user to press 'q' before continuing to type the
command. I tried to use fish_pager as
apropos -r "$s" | sed -r 's/ - /\\4/' | fish_pager 0 ''
but sed treats "\\4" as a reference, and anyway it is computationally
intensive and unnecessary to transform the output just so that it can
be shown the fish_pager.
Ideas about the general problem of how to use object-verb order are
also welcome.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users