Vimium: Support for Firefox

Created on 9 Feb 2017  ·  13Comments  ·  Source: philc/vimium

Firefox now supports WebExtensions. It would be nice to tweak Vimium to work on Firefox.

This is related to #2076.

So far, I've developed some basic support in my fork:

  • branch no-depreciated-apis changes code using depreciated APIs (which FF will not implement) to use their replacements.
  • branch firefox-compat makes some changes to support Firefox, where the current code does not run correctly.
  • branch firefox-51-compat works around some unimplemented features in FF51, the current release. They are fixed in FF52.

You can use branch firefox-merger to test, which is simply all of these merged into master.

Most helpful comment

Thanks for the FYI @mcomella. In case it's not clear to passersby, Vimium does work in Firefox 57, see Vimium-FF. I, for one, and coming from VimFx, am happy with its feature set. Thanks Vimium folks 🙂.

All 13 comments

Thanks, @mrmr1993. Reviewing the final branch mentioned above, it looks like the required changes aren't really that disruptive. How complete is this? (I don't have the setup to test this.) I know @philc is interested in adding Firefox support.

I probably still need to look at non-normal mode key handling. Other than that, it seems complete, but Firefox isn't.

Some example problem Firefox bugs:

  • disabling a element while it is focused doesn't blur it, and results in (nearly) all key events being suppressed.

    • in practice, this means that we get stuck on the save button in the options page. A .blur() before disabling should fix that, but we can still get stuck on other pages.

    • general escape strategy is [tab][esc], but still bad UX.

  • no support for the clipboard API, which stops several commands working
  • all simulated mouse clicks with modifiers (think opening tabs in foreground/background) do not trigger the default option

    • combined with the clipboard issues, this means that it is difficult to open a link in a new window. (Suggested nasty workaround is fytJH)

  • keypress always fires, so we can't distinguish printing and non-printing keys.

This is really cool; great start @mrmr1993. I would love to get a viable Firefox version out onto the store since the current crop of Vim-style extensions are going to stop working once the classic extension APIs are fully deprecated. Hopefully Firefox support won't incur a large QA/maintenance burden.

I haven't stressed tested it with days of usage, but I will try to. However, there were a couple of things I noticed right away:

  1. Link hints on this bing page appear much slower than on Chrome. It takes between 250ms-1000ms, whereas with Chrome, it's instant. Not sure if that's just poor performance from Firefox, or some bad interaction between our link hints code and Firefox.
  2. I was able to get into a state where I had link hints showing, but ESC didn't dismiss them, and other keys were being registered (e.g. you can use j/k to scroll the page, even though hints are showing). I got here by very quickly toggling between the f and esc keys, although it's not easy to reproduce.

Have you used it much in practice @mrmr1993?

Have you used it much in practice @mrmr1993?

I've completely switched from Chrome to Firefox, so I'm using it a lot. There's plenty that isn't working, but my barely-patched version works well enough for my current day to day.

I would love to get a viable Firefox version out onto the store

Is anybody else (interested in) working on this at the moment? I can start actively working on the project again, if not / if it would help.

FYI:

https://addons.mozilla.org/en/firefox/addon/vimfx/
There is an addon on amo which is similar with Vimium for Chrome [EDIT: Still using old Addon-SDK though]

https://addons.mozilla.org/en/firefox/addon/vimium/
And a deprecated addon which is also called vimium...

I wish to contribute to this project, making vimium work with firefox :)

how can i actually install from the firefox-merger branch? i would also like to try it out and test it.

  • Clone the branch.
  • Install Coffeescript.
  • Run cake build to build.
  • Add the extension temporarily (you'll have to do this each time you start your browser; it's a PITA) from the URL about:debugging, by selecting any file in the folder containing your clone.

@mrmr1993 What's the status of this?

We should probably merge firefox-merger and create a TODO list of gaps between the chrome and firefox version. Once we get to the point where it's ready for wide adoption, we'll get it onto the Firefox addons site.

We should probably merge firefox-merger

I've rebased firefox-compat onto master. To get Vimium working with Firefox, it should be enough to merge firefox-compat-rb (the rebase branch).

@mrmr1993 What's the status of this?

Other things that need fixing, either on our side or on Firefox's:

  • showing the HUD in find mode throws an error (fixed in dfddd54)
  • window.find throws an error on page wrap. (needs more investigation, but e46a369 stops the errors. Also stops the find mode HUD losing focus after calling window.find).
  • open in foreground/background/etc. doesn't work (FF issue 1356309)
  • clipboard API is unsupported (FF issues 1344410)
  • new tab page doesn't open with Chrome-specific URL (2f9beb73f24b698795a160f85cfe62f00406594d fixes this to support Chrome and FF edit: can't currently find a way to open new tab in FF at all, but about:newtab seems like a more likely candidate going forward. FF issue 1275209.)

This is everything that springs to mind for now.. I'll tidy this up and push a PR.

FYI: it was announced that legacy extensions will stop working in tomorrow's Firefox Nightly so presumably VimFx, Firefox's Vimium counterpart, will also stop working in 57. With a brief skim, it doesn't look like their initiative to switch to WebExtensions is progressing (https://github.com/akhodakivskiy/VimFx/issues/860).

Thanks for the FYI @mcomella. In case it's not clear to passersby, Vimium does work in Firefox 57, see Vimium-FF. I, for one, and coming from VimFx, am happy with its feature set. Thanks Vimium folks 🙂.

Was this page helpful?
0 / 5 - 0 ratings