vimium icon indicating copy to clipboard operation
vimium copied to clipboard

Feature request: Allow keyboard shortcuts with modifier keys to be used at any time

Open wolfmanstout opened this issue 2 years ago • 1 comments

I have been quietly maintaining a minor fork for nearly 8 years which does this successfully, so I figured it was worth sharing the idea here to see if it makes sense to clean up and integrate upstream.

Today, as in Vim, Vimium users have to manually switch between insert and command modes if they wish to issue a command while typing in a textbox. This requires some cognitive overhead and additional keystrokes. It is, of course, a defining feature of Vim, but nearly every other popular editor uses a modeless approach, using modifier keys (ctrl, alt, etc) to distinguish keyboard shortcuts from typed text. My humble proposal is to support the same convention in Vimium for those who wish to benefit from Vimium features without managing modes.

There are several ways this might be implemented. The most conservative approach would be to simply allow keyboard shortcuts that contain modifier keys to be used in insert mode -- or at least provide this as an option to the user. This would work well for users who want to have some commands available everywhere, but still wish to have modes. A more radical approach (the one taken in my fork) is to give the user an option to completely disable insert mode. In this case, they would need to use modifier keys for all keyboard shortcuts (and this could be enforced to avoid infuriating users). The major advantage of this approach is that it frees the user from having to think about modes at all.

If this is something you are interested in, we could discuss what it would take to support this cleanly in Vimium. My fork is three years out of date and I simply disabled the insert mode and number prefixes entirely and updated the shortcut defaults. I understand we would need a more surgical approach here.

Finally, I want to note that I do appreciate the irony of a proposal to support disabling the defining Vim UI convention from an extension called Vimium! But practically speaking, I suspect that many of your users love the extension because of all the helpful functionality it offers, not because of this modal UI convention. For my own part, I use my fork in combination with a voice control system, for accessibility reasons. It is enough cognitive overhead using voice control as it is, so it's very nice to not have to think about these mode switches.

wolfmanstout avatar Aug 15 '22 00:08 wolfmanstout

My customized version of Vimium, https://github.com/gdh1995/vimium-c, has also supported this, and its idea is:

  1. If you want to use a shortcut key to trigger an extension's commands, then you must have got a key name and a command name
  2. So my extension supports mapKey <source_key> <v-new_key> and map <v-new_key> CommandName
  3. Then my extension will always treat all key names starting with <v- as shortcuts, even when it's in Insert or Visual mode.

gdh1995 avatar Aug 15 '22 03:08 gdh1995