Try this: open up Mozilla’s Bookmark Manager (Bookmarks, Manage Bookmarks), right-click a bookmark, and pick Properties. Adding a short string to the Keyword field will let you go directly to that URL by entering that keyword in Mozilla’s navigation bar. I had known about this for a while, but hadn’t done much more than just play with it—typing “www.whatever.com” didn’t seem like that much trouble to me.
Then I found out about Mozilla keymarks. Now try this: do a search for a particular word in Google, and then bookmark the result. In the bookmark’s properties dialog box, enter “g” as the keyword. Then, in the URL shown in the same dialog box’s Location field, replace the search term that you entered with “%s” so that it looks something like this (if you like, just replace the whole URL with what I have here):
Once this is saved, you can enter a Google search query after the “g” keyword and the search will be executed. You can add multi-word searches, quotation marks, and specialized parameters like site:. The following examples all worked just as I expected:
g site:w3.org emacs g "bob quine" OR "robert quine" g "dave thomas" -wendy's
Now the Navigation bar feels like a command line to me. I no longer need the one-field form I have on my browser’s default home page, which does a Google search. I can jump to the Navigation bar by just pressing ^L, making it even quicker to link this way. And, I’ve created several new “commands” by assigning the following keywords to the following URLs:
|imdb||Internet Movie Database||http://www.imdb.com/find?tt=on;nm=on;mx=20;q=%s|
|imdbname||Internet Movie Database (name search)||http://www.imdb.com/find?nm=on;mx=20;q=%s|
|imdbtitle||Internet Movie Database (title search)||http://www.imdb.com/find?tt=on;mx=20;q=%s|
Note how the last three keywords all point to roughly the same URL. The last, imdbtitle, searches only movie titles, and imdbname searches only names. (Compare the results of “imdbname ed wood” and “imdbtitle ed wood”.) Different keywords do slightly different things there; it’s like having different commands to achieve different results.
(As “command line linking” goes, it is possible to add a URL to the command line when you start up Mozilla from the shell, sending the browser right to that URL. In Windows, this opens up a new window each time you do it, and in Linux, it gives you the “Select User Profile” dialog box, both of which I’d rather avoid.)
Now that I think of it, a script that performs a true command-line version of this to retrieve a resource from within a shell would be easy enough to write. It would:
Check the first parameter passed to it, and see whether it was g, imdb, bbcweb, or one of the other keywords it was configured to recognize
Store the remaining parameters in one big string
Map the keyword to the appropriate URL
Substitute the saved string of parameters for the %s in the URL
Of course, this would pull the retrieved resource to standard out or to a disk file; if you want it displayed in a browser, do the Navigation Bar “command line” trick describ. This scripted wget way, though, can offer some interesting ways to work with RESTful applications, especially if the output really does go to standard out and can be piped to processes that use that data as input.
Has anyone else developed a dependency on this?