Hacker News new | ask | show | jobs
by worble 2248 days ago
Firefox supports this, go into Settings -> Search and set a keyword for the search engine.

For example, if you set the keyword for DuckDuckGo to "ddg" and Google to "go", then typing "ddg <your query>" into the topbar will search DuckDuckGo, and typing "go <your query>" will search Google.

2 comments

DuckDuckGo itself supports this. Just start a query with !g to have it routed to Google. For example, "!g search on Google" would bring you to the Google search results page for "search on Google."

DuckDuckGo supports several other commands like this, which they refer to as "bangs."

https://duckduckgo.com/bang

The difference between the Firefox setting described by the GP and the DDG bang commands you mentioned is that the Firefox setting is close to zero latency since it’s handled by the browser. The bang commands need to go to DDG and then come back as a redirect, taking a few seconds more. On the other hand, the DDG bang commands work the same across other browsers too.
A query need not be started with a bang. Just add 'g!' or 'yt!' anywhere in your search terms and it should work fine.
Just as an aside, "bang" has long also been a term for "!" itself - hence the two characters starting shell scripts, "#!", being called "hashbang".
You can set a keyword for any bookmark. Firefox replaces %s with your query. Simply bookmark the search result page of any website, replace the query with %s and set the keyword for the bookmark.

Doesn't have to be search either. For instance, I use it for the nodejs docs, and npm packages too: "https://nodejs.org/api/%s.html" and "https://www.npmjs.com/package/%s". So I can type "node fs" open the fs docs for node, or "npm fs-extra" to look up the docs for "fs-extra" package on npm.

Even easier, Firefox has a right click menu option for form fields it think might be searches to add the search keyword directly.