philc / vimium

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

White list of enabled keys by URL #3190

Open borislt opened 5 years ago

borislt commented 5 years ago

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.

deeeeekun commented 5 years ago

+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.

afilp commented 5 years ago

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.

smblott-github commented 5 years ago

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.

afilp commented 5 years ago

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

image

Notes:

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).

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

off-by-one commented 5 years ago

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.

gdh1995 commented 5 years ago

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.

ght commented 5 years ago

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:

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

actionless commented 4 years ago

possibly duplicate of https://github.com/philc/vimium/issues/2890

gaerfield commented 4 years ago

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.

atsalolikhin-spokeo commented 4 years ago

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.)

gdh1995 commented 4 years ago

@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.

atsalolikhin-spokeo commented 4 years ago

@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. :)

CMCDragonkai commented 8 months ago

I'm starting to use Linear, and it has its own keyboard shortcuts, would be nice if I can specify keys to allow, instead of keys to disallow.

maksimmuravev commented 4 months ago

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.

Vimium still overrides escape.