Saturday, June 14, 2014

Neat Firefox Trick: Bookmark Keywords

Bookmark keywords have been in Firefox since before version 1.0, but it seems like nobody knows about them.  I make use of them daily, so I'm here to share this information with you.  This may also apply to other browsers, but who uses those anyway?

In my highly customized Firefox configuration, I have removed the search box from the location bar.  Instead of the search box, I use bookmarks with keywords to do my searching.  For example, if I wanted to search Google for "cats", I just type "g cats" into the location bar and hit Enter.  If I want to pull up a Wikipedia article, it's as simple as typing "wp <article name>" and pressing Enter.

Intrigued?  Thought so.  Here's how to do it:
  1. Go into the bookmark manager.
  2. I like to put all my keyword search bookmarks in the same folder to keep track of them, but technically speaking they'll work from anywhere.  Make a folder if you like, name it something like "quick searches" just so you can keep track of it.
  3. Make a new bookmark.  We'll be using a Google search for this example.
  4. In the Location box, paste in the following:
  5. Click the arrow next to "More" to reveal the Keyword box.  Type a single "g" in it.
  6. You're done!  Type "g <stuff>" into your location bar and watch it automatically fill in the URL with what you're typing.  Hit Enter to actually search Google.
If you know a bit of programming, you may recognize the %s as the one of the formatting placeholders from the C printf() function to include a string variable in the output.  If you type the keyword for a bookmark followed by a space, Firefox will replace the %s with everything you type after that.

Now that you know how to set them up and how they work, here's some keyword searches I use:
  • Google
    • Keyword: g
    • Location:
  • Google Images
    • Keyword: gi
    • Location:
  • Google Translate (format: tr from/to/phrase)
    • Keyword: tr
    • Location:
  • YouTube
    • Keyword: yt
    • Location:
  • Wikipedia (if you type an article name, it auto-redirects to the article!)
    • Keyword: wp
    • Location:
  • Subreddit (this is just for quickly bringing up a subreddit, it doesn't actually search a subreddit for a phrase)
    • Keyword: r
    • Location:
  • PHP Function List (you have to remember to replace underscores with hyphens, it's not an actual search)
    • Keyword: php
    • Location:
  • Acronym Finder
    • Keyword: af
    • Location:
Note that you don't need to use this on a search, you can use %s as I have in the Google Translate, Subreddit, and PHP Function List bookmarks to construct a URL on the fly, or even omit it entirely to just have a quick easy access keyword for a bookmark.

No comments:

Post a Comment

I moderate comments because when Blogger originally implemented a spam filter it wouldn't work without comment moderation enabled. So if your comment doesn't show up right away, that would be why.