How to Remap a Key to Another Key in Vimium

Viewed 959

I'm trying to remap the f key to another key on YouTube in Vimium because it conflicts with the full screen native shortcut. Ideally, it would only work for YouTube and/or other video player websites, but, at any rate, I'm trying to understand why adding something like:

map u f # or maybe `map f u`?

doesn't work globally. I've tried many other variations but nothing really worked. I think that the more proper way for this extension would be something like map f showShortcuts, but I don't know where to find a complete index for the correct showShortcuts types of commands.

So, does anyone know how to do this the correct way? Where can I find an exhaustive index of commands?

2 Answers

I use vimium-c and managed to solve the problem by reading the

Map a key for different command...

So this is how I have it for youtube Open the vimium-c options Shift + / it will open the key bindings and there you click options.

1st Add to Excluded URLs and keys

Pattern https://www.youtube.com/ Keys j k l

2nd Add to Custom key mappings

env youTube host="https://www.youtube.com/*"
map q runKey expect={"youTube":"scrollDown"} keys="q"
map e runKey expect={"youTube":"scrollUp"} keys="e"

With these settings you will have

For youtube j 10sec before k play/pause l 10ces later

For vimium-c q scrollDown e scrollUp

Now you can change q or e to some other keys if you wish. These are the ones that I found free (not used by youtube or vimium-c).

Maybe someone else has a better way of doing this, I don't know, but here it goes...

  1. The map function apparently doesn't accept key-key parameters, it is set to redirect to commands: map key command.
  2. Currently, there isn't a way of creating mappings for specific websites or patterns — see issue #3728.
  3. Besides scraping the code itself, I haven't found a summarized, exhaustive list of Vimium commands — they should be easily accessible through a table on the homepage of the documentation quite frankly. However, you can find a lot of them throughout the documentation, specially in the Tips and Tricks and the Key Mappings wiki pages..

So, following specially the last point, we get to your answer:

map u LinkHints.activateMode
map U LinkHints.activateModeToOpenInNewTab
Related