DuckDuckGo style !bang searches in Firefox

Replicate !bang searches locally in Firefox.

Today I found this bang-bookmarks GitHub repository via HackerNews which adds DuckDuckGo’s !bang style searches to Firefox via your bookmarks.

I knew you could add keywords to Firefox bookmarks to open a website by simply typing a few letters in the location bar. I did not know you could replicate !bang searches locally in Firefox! Adding a local search saves a roundtrip to the DuckDuckGo servers and does not share the search query with a third party. Faster and more privacy-friendly, double win!

Adding a keyword search to Firefox

Make sure you have the search bar visible in the toolbar, you can hide this again when you are finished. Go to the Firefox settings, choose “Search” and select the “Add search bar in toolbar” option.

Add the search bar to the Firefox toolbar

Now open the website you would like to search in. This can be Wikipedia, GitHub, or any website that offers its own search. We’ll add OpenStreetMap as an example. Click the loupe icon with the little plus in the search bar and click the icon of the search engine you would like to add. Next, go to the search settings (you can click the gear icon for that).

Add search engine to Firefox

In the search settings double click the whitespace next to the search engine in the “Keyword” column and add the keyword you would like to use, I went for “osm”.

Add keyword to search engine in Firefox

Done. In the location bar, you can now type your keyword, followed by a space and your search query.

Search via a custom search engine in Firefox

The keyword needs to come first though, in DuckDuckGo you can place your !bang keyword anywhere in the search query.