Vimium: White list of enabled keys by URL

Created on 21 Nov 2018  Ā·  12Comments  Ā·  Source: philc/vimium

The topmost feature configuration in Vimium's settings is: 'Excluded URLs and keys'.
Which is basically a blacklist.
But to enable only a couple of keys (e.g. scroll, tab switch) - you have to go through and disable all other keys. It's tedious.
Would be nice to have also a White list of enabled keys by URL.

Most helpful comment

@smblott-github Thanks! How about an interface similar to this?

image

Notes:

  • Keys are disabled when All Keys value is selected.

image

This will have (internally) the same representation as using Specific Keys with no specific value in Keys (so same as today, but with a new explicit option too).

  • The All Keys Except option allows you to add keys that "survive" any exclusion from other rules (i.e. "white list").

You may also use colors in the background of Keys (red/green) to show their purpose:

image

And this is the styling with the "All Keys" showing the Keys input as disabled.

image

To have consistency in colors (and understand what is excluded and what not), maybe have the ALL also in red color (and disabled):

image

All 12 comments

+1
I use keyboard shortcuts, for example, on video streaming sites to control playback. Vimium shortcuts would sometimes interfere with them so I disable Vimium on those URLs, but it would be nice if I could just keep the bare essentials like opening tabs.

I also need this a lot.

Youtube is one example. The F key there is "Full Screen". I had to exlcude "vimium" all together for Youtube, because I really need the "Full Screen" shortcut also.

Would be nice to have also a White list of enabled keys by URL.

Yes. But it would also have to be obvious for new users. And when you bundle it together with the feature request that you can also exclude (or include) modified keys, it all becomes quite complicated.

That's why I've never taken it on. I just list the keys I want to use from the page.

@davidgenesiscruz and @afilp ... You might be looking for insert mode (i), or perhaps the passNextKey command.

@smblott-github Thanks! How about an interface similar to this?

image

Notes:

  • Keys are disabled when All Keys value is selected.

image

This will have (internally) the same representation as using Specific Keys with no specific value in Keys (so same as today, but with a new explicit option too).

  • The All Keys Except option allows you to add keys that "survive" any exclusion from other rules (i.e. "white list").

You may also use colors in the background of Keys (red/green) to show their purpose:

image

And this is the styling with the "All Keys" showing the Keys input as disabled.

image

To have consistency in colors (and understand what is excluded and what not), maybe have the ALL also in red color (and disabled):

image

I second this - my current workaround is to list all keys I remember and then remove the keys I want to use. This is especially true on websites where I use vim controls internally (cocalc, overleaf), which mean I need very restrictive whitelists to keep vimium from interfering with the site.

You may be interested in this idea: https://github.com/philc/vimium/issues/3272#issuecomment-475296695 , and I've implemented it in my customized version of Vimum, Vimium C.

BTW, I have a customized version of Vimium (https://github.com/gdh1995/vimium-c), and I've added 2 new features: "whitelist of hooked keys in exclusion rules" and "command to toggle Vimium's status", so you may have a try: https://github.com/gdh1995/vimium-c/releases

Configure on the options page:

  • add an exclusion rule

    • its "patterns" can be what you like, (if a pattern starts with "^", then it's a regexp)

    • the "keys" should start with a "^", and all others are auto parsed and splitted by spaces

    • each unit (split by spaces) will be a (composed) key which will be hooked by Vimium C

    • all other keys will be passed

    • let's say the keys is "^ <f9> <f10>" for a page of "^file:///D:/"

  • add some key mappings including:

    • mapĀ <f9>Ā openUrlĀ url="vimium://status\u0020enable"

    • mapĀ <f10>Ā openUrlĀ url="vimium://status\u0020reset"

    • mapĀ <s-f9>Ā openUrlĀ url="vimium://status\u0020disable"

    • warn: if disabled, no key mappings will be in use, so it can be re-enabled only from the popup page / omnibox "v" URLs.

Usage examples:

  • open file:///D:/ and press other keys except <f9> or <f10>

    • Vimium does nothing

  • press <f9> and then press f, so Vimium will show link hints
  • exit link hints mode and presss <f10>, so Vimium will be reset to the initial "white-list-of-hooked-keys" mode.

Is it enough? Any ideas are welcomed.

I like this feature proposal and would use this. I find @afilp's UI mockup unnecessarily complex though:

  1. there are really only 2 options, not three: whitelist and blacklist. "All Keys" is already covered by selecting whitelist and leaving it empty
  2. not avoiding double negatives does the opposite of reducing confusion; Instead of "Exclude all keys except ā€¦", I suggest "Allow only ā€¦"

I'm not good with mockups, but I suggest to keep this as simple as possible:

  • a simple toggle icon added to the current UI
  • two states: blacklist(default)/whitelist
  • when toggled:

    • the icon changes

    • placeholder text changes ("Exclude keys"/"Allow keys"), show that as title text/tooltip on the icon as well

    • maybe the color changes too as @afilp proposed

Maybe "Enable" would be better than "Allow", I'm not a native speaker.

For everybody else finding its way here, this is my (incomplete?) list of all keys I got identified:

jkgGuhlzHzLryypPgugUivVgifFmoObBTeE/nNHLtJK^yxXW?

Until solved, copy&paste this and remove keys you like to use.

I would like to be able to use GitHub's y hotkey to get the permalink when on GitHub (see https://docs.github.com/en/github/managing-files-in-a-repository/getting-permanent-links-to-files)

I don't want to turn off Vimium on GitHub, because I can't live without Vimium. :) For example, I use yy to copy the current link. So... is there some way I can get the GitHub permalink through Vimium? (Not sure if this belongs here or in its own issue.)

@atsalolikhin-spokeo You may try adding exclusion rules to always pass some keys to GitHub, or binding a key to passNextKey to pass a key once a while.

@gdh1995 : thanks for replying! I considered writing an exclusion rule to always pass y to GitHub, but that would break the Vimium yy key combo, which I use to copy the URL of the current page.

I wasn't aware I could bind a key to passNextKey, there is no mention of that on the Vimum Options page.

Aha! I found https://github.com/philc/vimium/wiki/Tips-and-Tricks Yay! :) Thank you. :)

Was this page helpful?
0 / 5 - 0 ratings