2009-12-08

Firefox customization: address bar shortcuts

I prefer disabling Firefox search bar at all and using only address bar for both navigation and search queries. I'm so used to it that I've nearly forgotten the search bar shortcut. Was it Ctrl+K?



Anyway, Firefox has an annoying bug, although they would definitely call it a feature. If you write something into the address bar and mistakingly hit Shift+Enter instead of just Enter, Firefox will wrap your query with 'www.' and '.net', so that 'something' would become 'www.something.net'. If it meant to be a search query, it isn't anymore. I hate this behavior because it is useless for me, and hitting Shift accidentally is exactly my case.

This is not the only shortcut. So, Ctrl+Enter shortcut will add '.com' suffix, Ctrl+Shift+Enter will add '.org' and some other magic is also possible, I haven't tested it so thoroughly.

Good thing is that Ctrl+Enter behavior alone can be fixed directly in 'about:config', for example, if you want to substitute '.co.jp' instead of '.com':

browser.fixup.alternate.prefix = www.
browser.fixup.alternate.suffix = .co.jp


... or to disable prefix/suffix substitution completely:

browser.fixup.alternate.enabled = false


... and no way to handle Shift+Enter. This is the bad thing.

But Firefox is also well-known for its add-on base, and URL Suffix add-on is likely to solve other shortcut issues. Just install it, restart Firefox, open add-on preferences window and wipe all the prefix and suffix fields. Hit OK. Firefox will no longer mess with stuff you enter into the address bar.



But wait, there's more. If we have to keep this add-on anyway, why not make real use of it? So, let's configure prefixes and suffixes to use popular search engines by shortcuts. Here are my preferences, you should know how to fix them according to your needs:

E: [] []
CE: [http://en.wikipedia.org/w/index.php?title=Special%3ASearch&search=] [&go=Go]
SE: [google.com/search?q=] []
AE: [http://packages.ubuntu.com/search?keywords=] [&searchon=names&suite=karmic&section=all]
CSE: [http://www.wolframalpha.com/input/?i=] []
CAE: [http://ru.wikipedia.org/w/index.php?title=Special%3ASearch&search=] [&go=Go]
SAE: [http://nigma.ru/index.php?s=] []
CSAE: [http://lurkmore.ru/Special:Search?search=] [&go=Go]


All done. Now, anything you enter into the address bar could be either
  • handled directly (search Google, fetch the first result if obvious match occurred), or
  • fed to a number of search engines without the need to use a keywords.


One more bonus: you can now enter queries like 'site:.fi linus' without bothering that 'site:' part will be handled as protocol. Just hit Shift+Enter, the query will be fed to Google directly without being parsed by Firefox, Gecko or whoever.

Enjoy.

No comments: