vimium icon indicating copy to clipboard operation
vimium copied to clipboard

[Feature Request] option to use (just) <shift> to trigger actions

Open kkimdev opened this issue 1 year ago • 8 comments

Hi, f key often conflicts with website-defined shortcuts (like f is Fullscreen on YouTube), and personally would prefer to use just <shift> for quick access, not combined with other keys.

This is not possible with vimium now to my understanding, and it would be super useful to me, thanks!

kkimdev avatar Jan 19 '25 18:01 kkimdev

youtube

2zs8ik22 avatar Jan 19 '25 18:01 2zs8ik22

If you're frequently "annoyed" by "F" for fullscreen on websites with video players, you don't necessarily need to unmap / exclude the Vimium f key in order to use the fullscreen hotkey. You could simply go into insert mode with i to pass all of your next key events to the underlying website until you exit insert mode again.

Another option is to bind Vimium's passNextKey command to a key of your choice to only pass the very next key you press to the website. That way you wouldn't need to enter and exit insert mode.

Maybe this helps.

philg-dev avatar Jan 20 '25 02:01 philg-dev

Thanks for the answer and tips! I really appreciate this awesome extension you're maintaining!

Personally, I prefer using Shift. I first encountered using Shift for quick link shortcuts on a random browser a few years ago (I can't remember the name), and I really enjoyed the experience.

I might be in the minority, so please feel free to close this issue. I'm considering creating a private fork to have this feature for myself, but I opened an issue just in case.

kkimdev avatar Jan 20 '25 03:01 kkimdev

I really appreciate this awesome extension you're maintaining!

I'm just a mere Vimium user - I'm not a maintainer. I just try to help out when people have issues.

Maybe your feature request will get traction, so I guess let's see if anybody else has an opinion on this before you close it.

philg-dev avatar Jan 20 '25 11:01 philg-dev

Actually, I wonder if I can trigger a Vimium action programmatically. I can enable the following shift detection snippet on every page using this extension https://chromewebstore.google.com/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld

let isShiftKeyDown = false;

document.addEventListener('keydown', (event) => {
  if (event.key === 'Shift') {
    isShiftKeyDown = true;
  }
});

document.addEventListener('keyup', (event) => {
  if (event.key === 'Shift' && isShiftKeyDown) {
    executeShiftSequence();
    isShiftKeyDown = false;
  }
});

function executeShiftSequence() {
  // Your code here to handle shift down-shift up sequence
  console.log('Shift down-shift up detected!');
}

kkimdev avatar Jan 21 '25 03:01 kkimdev

I'd think it would be easier to just make your own fork, but you could try doing it that way.

As far as having modifier keys alone trigger actions, it seems doable, but a major conflict is that many of the default shortcuts use shift as part of the shortcut. For example, we have j, k, and J, and K. If we added a mapping for <shift> then we couldn't do J or K without triggering the quicklinks <shift> binding.

Of course, a user could always remap all keys to not use any with shift, but since many defaults use shifted keys, I wouldn't see this being a very used feature.

Those are just my thoughts. Having it as an option could be good. If we did, we might need to implement a warning to let people know they would break their other bindings.

UncleSnail avatar Jan 21 '25 05:01 UncleSnail

but a major conflict is that many of the default shortcuts use shift as part of the shortcut. For example, we have j, k, and J, and K. If we added a mapping for <shift> then we couldn't do J or K without triggering the quicklinks <shift> binding.

Yeah right, this case is handled in the above code fwiw. When another key is pressed after , like -, isShiftKenDown becomes false and keyup event wouldn't call executeShiftSequence.

kkimdev avatar Jan 21 '25 16:01 kkimdev

consider installing https://github.com/houmain/keymapper and create a binding for shift that is specific to your browser task.

something like

[path="FIREFOXEXE"]
ShiftLeft >> Q 

then in vimium bind Q to your liking

kbilsted avatar Feb 11 '25 19:02 kbilsted