Saturday, December 7, 2013

Configuring an "I feel lucky" search shortcut in Chrome

I normally blog about programming stuff, but this is just one of those "superuser life pro tips" that I feel I have to preach to the world. You know those times when you need refreshed how to do Padding with String Format and you just know you're gonna click the top result? Or the argument list of PHP strstr, that stinking DateTime parsing in Java? Or, or or...

The "I feel lucky"-function has been around for years, but it's really not effective. You have to 1. Go to www.google.com, 2. type the search text, 3. move the mouse over to the "I feel lucky" link and click. No one goes to google.com anymore anyways, right? You just type in the search address bar, or "omnibox" as it's called in Chrome. But you're still forced to do two moves because you have to see the results first. That of course is not by accident. But we're programmers. We work around stuff :-)

Hence I present you the Google I-Feel-Luck "search engine". It's not rocket science, but I had to Google it to get the answer (Thank you timmmy_42). This is how to do it in Chrome (but I guess there's equivalents in both IE, Firefox and Opera):

  1. Open Settings

  2. Click on Manage Search Engines


  3. Create a new entry with the following parameters:
Search engine:"Google Lucky" (or other name of your choice)
Keyword"l" (or other short keyword of your choice)
URLhttps://www.google.com/search?q=%s&btnI


Voila! You may now perform an "I feel lucky" search in chrome by prefixing your search with the letter L in the omnibox. Example:




Click enter:



edit: I've noticed that Google doesn't always bring you directly to the result even if you do include the Im-feeling-lucky query parameter (the Java example in my post for instance). If anyone can find a pattern in when this happens, I'd be glad to learn more about this.

4 comments:

  1. You might also use vimium to avoid having to use the mouse. Type "f" after you search in the omnibox, and you can select links using only regular letters (you can configure the letters that should be in use). Great plugin - at least if you're used to vim :)

    ReplyDelete
  2. Nice - thanks. I was looking for a quick way to query MSDN documentation.. Search engine="MSDN Lookup", Keyword="class", URL="https://www.google.com/search?q=site%3Amsdn.microsoft.com+class+%s&btnI". In use, e.g."class WebClient" gets you there with a minimum of effort!

    ReplyDelete
  3. very nice. thanks

    ReplyDelete