Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Bang Bookmarks – replicate DuckDuckGo bangs in Firefox using Keymarks (github.com/jameshealyio)
123 points by apimade 13 days ago | hide | past | favorite | 39 comments

As I understand it, this makes use of the 'Smart keywords' feature that's native to Firefox[1]. Take a search URL, add a keyword to it, and you can then use it as 'keyword search_term'. I use this for a few of the sites that I frequent.

[1]: https://support.mozilla.org/en-US/kb/how-search-from-address...

What's a pity is some browsers don't promote their native features, which leads most to be unaware of them and then browser makers likely see metrics showing little use of them.

Opera (pre-Chromium) had this feature to begin with, then Firefox (using bookmarks to store the keywords instead). Vivaldi browser retains the Opera style custom search UI and whenever I find myself searching a site enough I just create a nickname for it (eg: to archive the URL directly to archive.org/is, search caniuse.com, among dozens of others).

> What's a pity is some browsers don't promote their native features, which leads most to be unaware of them

Too true. I've wondered for a while what the keyword field in a bookmark was for.

I also found out just the other day that I can add search engines to Firefox[1] if the site supports the OpenSearch API[2]. I didn't know they could be added this way, nor did I know about OpenSearch, if I hadn't have searched for an easier way to search a site I frequent then I would never have known.

[1] https://support.mozilla.org/en-US/kb/add-or-remove-search-en...

[2] https://developer.mozilla.org/en-US/docs/Web/OpenSearch

Chrome also has this feature: I recently realised this as a Firefox user after being semi-forced to half-switch to Chrome for a good portion of my work.

It's incredibly well hidden though, and the UX is horrific, which I'm convinced must be deliberate.

Yeah, I use this feature constantly. I have e.g. wp to search wikipedia, im to search imdb, di to search dictionary.com.

For anyone else on Firefox, there's no need to go through a search engine or install anything. Just follow the instructions in that link. It'll change your life.

I used to use smart keywords heavily. I outsourced the work of maintaining a useful keyword list to DuckDuckGo.

Yes. Just find any search box in firefox, right click on it and select "Add a keyword for this search."

This feature has been implemented since I started using firefox, circa 2004.

This used to be present in Chrome too (a few years ago), but now the only way is to go in the settings and manually add a new search engine.

I Think you can put this into single local HTML file and instead of polluting your bookmarks with thousands items make just single keyword bookmark pointing to the HTML and let it handle all the functionality in embedded JavaScript.

The only difference would be one extra space needed for invocation, i.e. instead of `!github test` you'd need to type `! github test`.

I tried this about ten years ago and it seemed to work.

From https://gist.github.com/myfonj/36a2a72a8ac6b6172ee32aae271e7... :

     # place this file somewhere on your disk
     # open it in Firefox
     # bookmark it, so it's address is like
     # file:///c:/web-root/utils/firefox-shell.html
     # edit new bookmark: append '?%s' to its URL, so it becomes
     # file:///c:/web-root/utils/firefox-shell.html?%s
     # set some handy Keyword, eg. '>', '#' or '!' for it
     # try it. you should see a list of defined 'bookmarks' (testing only)
     # extend, tweak.
     # remember that you must use space after the main Keyword: "> command argument1 argument2"

It is worth noting that the spaced syntax (`! github test`) has its own separate meaning with DDG: Go straight to the first result.

True. My all times favourite is to use it in keyword bookmark for `site:<domain>` so you can go straight to "most relevant page from <domain>" with e.g. `mdn <word>`:


Clever! Thank you for sharing. MDN is specifically the site I most often use this feature for as well. This might be a better substitute, as I have ended up on MSDN a few times in the past when just straight up searching "! mdn <query>".

One of the big advantages of DDG's bangs is that you don't have to re-type/paste the whole search query. Instead, you click the search bar in DDG, type `<space>!g<enter>`. That's vastly simpler and faster than re-typing the query, then `<space>!g<enter>`.

One of the thing that I miss from Chrome from a while ago is the integration with Google. I remember that Chrome would show the query in the omnibar (on mobile anyway) when doing a search on Google. So if you needed to make changes to the query, you can continue doing so within the omnibar.

I think if we can get something like that Chrome feature in Firefox but for DDG (or maybe any search engine?), using Firefox's smart keywords feature would be a lot simpler, and you can bypass the extra request to DDG that it would otherwise take.

> One of the big advantages of DDG's bangs is that you don't have to re-type/paste the whole search query. Instead, you click the search bar in DDG, type `<space>!g<enter>`. That's vastly simpler and faster than re-typing the query, then `<space>!g<enter>`.

At least in Firefox you can also re-enable the search box and just use that. It's even accessible via it's own shortcut (ctrl+k).

Didn't actually think of that. I'd forgotten that was an option, however, I've never liked the separate search box. It just feels like a waste of space. I don't want to think about whether I should press Ctrl+L or Ctrl+K. Half of the time I don't yet know whether I want to search or go to a site.

Along with that, they're a bit smarter. If you set a search period (last week), the !g bang will pass it along to Google.

Also, you can use just a `!` for Im Feeling Ducky, to visit the first result.

Chromium based browsers also have a similar feature under the "Manage Search Engines" settings (Took me a while to find this after I switched to Firefox)

I personally use short keywords like "ccc Lego" to search CamelCamelCamel or "e Razer" to search eBay

One thing Firefox does make trickier is that it doesn't make clear you're searching your custom search engine. Chromium recognizes my "ccc", so once I hit space it replaces it with "Search CamelCamelCamel: Lego". Firefox just leaves the bar "ccc Lego", makes it tricky to know if it recognized it.

Current Firefox also has keyword search for installed search engines-- this gives a UI similar to Chrome (where the keyword gets replaced by the search engine name after you hit space) as well as search suggestions for search engines that support it. You can change the keywords in Firefox preferences, under Search Shortcuts on the Search tab.

What's a little unclear about this feature is how you add new search engines to this list-- since there's more functionality here than old-style bookmark keywords, it's not just a matter of right-clicking in a search field or pasting in a URL with a placeholder in it. On supported sites, click the location bar-- at the bottom of the dropdown, you'll see a "This time, search with:" entry with icons for each of your installed search engines, and, if the site supports search, an additional icon with a green "+". Click that to add the search engine, then set your keyword of choice in Preferences.

> One thing Firefox does make trickier is that it doesn't make clear you're searching your custom search engine

That's true, and an extension helps actually making those behave like real search engines: https://addons.mozilla.org/en-GB/firefox/addon/add-custom-se...

Alfred (on macOS) makes this even easier and browser-agnostic: https://www.alfredapp.com/help/features/web-search/

It’s a shame, that it only works at the beginning of the query. "search terms !bang" is extremely common for me :/

Me too :(

I have been struggling with bookmark management and discovery. I eventually landed on the following command which allows me to store my bookmarks in my git backed notes. For discoverability this also works surprisingly well due to the file paths containing a lot of searchable context around the bookmark.

open $(rg -o -e "\[(.?)\]\(http.?\)" <PATH_TO_NOTES_DIR> | fzf | rg -o "http[s]?://.[^\)]+")


This looks specifically for the [markdown link syntax](https://www.markdownguide.org/basic-syntax/#links). Lastly, it does require ripgrep and fzf to be installed.

A previous discussion of my writeup on this awesome feature: https://news.ycombinator.com/item?id=19520966

Was thinking about something exactly like this the other day. DDG is more useful for using other sites as search engines than it is by itself. Any chance this can be ported to chromium browsers too?

It's already in chromium browsers, just press tap after the domain.

You can even right click in pretty much any search field and click the context menu option to make a keyword bookmark for that field. Wild.

The grand irony is that this first existed in Konqueror (20ish years ago?). This was one of my favorite features in it. Konqueror was a phenomenal browser for the time.

And for those unaware, Konqueror used KHTML, which gave birth to WebKit, which Safari used, and then of course eventually Chrome used until forking it into Blink.

Firefox had this nearly 20 years ago, and morphed into keyword search.

This is the reason I made ddg the default search engine. So I can search any website right from the bar.

Can anyone remind me what the internal Facebook (sorry, Meta) tool for this is called? Im sure there have been versions of that released as open source.



Anyone who made it work on https://hn.algolia.com/?


And add whatever keyword you want.

The magic is %s gets replaced with whatever string you add after the keyword.

This may fix the reason I left Firefox. Keyword searches don’t work in the search bar, only the address bar. So when I wanted go to back to Google from DDG, I was forced into an omnibar situation. This wasn’t the first feature cut that ran me off, it was the last. If I have to use an omnibar going forward, I may as will be using my native browser so I set up my keywords in Edge.

Anyone remember yubnub?

I do! I missed the "web command-line" functionality so much I made a self-hosted replacement for it that can be run from a local file[0].

If you add it as your default search provider you can use it directly from the address bar, and at that point it works very similarly to DDG bang syntax (although it does a few other things apart from bookmarks as well).

[0]: https://github.com/dohliam/yub

Is yubnub not working anymore? Looks operational at first glance.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact