Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make keys not bound to anything in normal mode be usable #188

Closed
nikitavoloboev opened this issue Aug 22, 2020 · 3 comments · Fixed by #194
Closed

Make keys not bound to anything in normal mode be usable #188

nikitavoloboev opened this issue Aug 22, 2020 · 3 comments · Fixed by #194
Assignees

Comments

@nikitavoloboev
Copy link

If I haven't bound a key to anything, it should be available for use as if you are in insert mode.

For example arrow keys in YouTube should work as I haven't bound arrow keys to anything in my bindings:

"bindings": {
      "hintToggle": "f",
      "newTabHintToggle": "shift+f",
      "scrollUp": "k",
      "scrollDown": "j",
      "scrollLeft": "h",
      "scrollRight": "l",
      "goToPageTop": "g g",
      "goToPageBottom": "shift+g",
      "goToFirstInput": ":",
      "goBack": "shift+j",
      "goForward": "shift+k",
      "reload": "r",
      "tabBack": "a",
      "tabForward": "w",
      "closeTab": "e",
  }

Same for all other keys. Like v or o and so on. This was allowed by sVim too and is super useful.

@danielcompton
Copy link
Member

Yeah, I've noticed this too and I think it's a pretty big workflow regression. We should fix this or revert the normal mode patch before submitting to the App Store.

@nbelzer
Copy link
Collaborator

nbelzer commented Aug 28, 2020

I've implemented this behaviour in branch 188-normal-mode-non-bound-keys. As we can only isolate keys on a per-key-basis I had to isolate all keys that are bound according to the settings. This means that even though by default g doesn't do anything in Vimari it is isolated because it is part of both g+i,shift+g, and g+g. See included code below for reference.

In my opinion we should add this as a preference (something like transparentBindings) that defaults to true as it is a workflow regression as said before.

// Returns all keys bound in the settings.
function boundKeys() {
    var bindings = Object.values(settings.bindings)
        // Split multi-key bindings.
        .flatMap(s => s.split(/\+| /i))
    bindings.push(settings.modifier)
    // Use a set to remove duplicates.
    return new Set(bindings)
}

@nbelzer nbelzer self-assigned this Aug 28, 2020
@xster
Copy link

xster commented Sep 8, 2020

Random note for future readers: if you made your userSettings.json before #194, missing json keys don't seem to inherit from the default settings. You have to specifically add it to your userSettings.json it seems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants