philc / vimium

The hacker's browser.
https://chrome.google.com/webstore/detail/vimium/dbepggeogbaibhgnhhndojpepiihcmeb
MIT License
22.62k stars 2.45k forks source link

Custom search engines / Bookmark integration #2610

Open aw-bib opened 6 years ago

aw-bib commented 6 years ago

vimium allows to define custom search engines in vimium options.

This effectively duplicates a (probably lesser known) function of Firefox Bookmarks where you can specify a keyword for all kinds of searches for quite some time. In "classical" Firefox the keyword is evaluated similarly to vimiums usage, and %s expansion works the same as in vimium. E.g.

w: http://www.wikipedia.org/w/index.php?title=Special:Search&search=%s Wikipedia

could as well be done as a bookmark using

Name: Wikipedia
Location: http://www.wikipedia.org/w/index.php?title=Special:Search&search=%s
Keyword: w

Besides having a bit an easier to handle interface via bookmarks, the decoupling of both functions leads to o w: searchterm to behaves differently than entering w searchterm into the URL bar with the above bookmark, and it can be quite confusing that the o-bar does not behave like the url bar.

It would be nice (and is probably even straight forward) to rely on the build in bookmark functionality of Firefox.

gdh1995 commented 6 years ago

I haven't tested it but maybe VImium can not know bookmarks' "keyword" on Firefox. So it seems too hard to implement this.

Refer: on https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/bookmarks/BookmarkTreeNode , there's no "Keyword" property in a bookmark node.

aw-bib commented 6 years ago

Hm, I wonder how it's done in vimperator. Probably, one could "just" steal the url bar?

gdh1995 commented 6 years ago

Firefox's "plugin" framework supports the "keyword" property, but Mozilla has decided to replace this platform with the "WebExtension" framework progressively, because WebExtension supports the multi-process browser architecture well (so safer than "plugin") and is also preferred by Chrome and Microsoft Edge.

Unfortunately, WebExtension is based on Chrome's extension framework, and it seems that Chrome has no such a usage.