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

Support compound keys (<a-f>, <c-[>, etc.) in passkeys #1368

Closed
wants to merge 3 commits into from

Conversation

mrmr1993
Copy link
Contributor

This implements support for compound passkeys, which must be separated from other passkeys keys by a space. We require spaces since

  • we can't map to the (space) key, so it doesn't cause any problems, and
  • we need to be able to have < and >, since some people have bindings using them.

This is a follow-up to an idea from the conversation on #1211.

@z0rch, @smblott-github, can you take a look, possibly in conjunction with #1140?

# Keys are either literal characters, or "named" - for example <a-b> (alt+b), <left> (left arrow) or <f12>
# This regular expression captures two groups: the first is a named key, the second is the remainder of
# the string.
namedKeyRegex = /^(<(?:[amc]-.|(?:[amc]-)?[a-z0-9]{2,5})>)$/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to ignore case for named keys, i.e. treat <A-b> in the same way as <a-b>.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pinched from the background page, so (for now, at least) I think it's best leave as is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it matters here, but case in keys matters since <A-b> and <a-b> are two different combinations and matching without case, would create weird ambiguity errors

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deiga are they different? I think <A-b> and <a-b> are same and both mean Alt+b, while <a-B> and <A-B> both mean Alt+Shift+b.

Update: I was talking about the conceptual idea in vim, not about the current implementation in vimium.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment we don't support capitalised modifiers for mappings. This regex is copied from there, for consistency.

If this is a bug, we can open a separate issue/PR and discuss it there.

@maximbaz
Copy link

@mrmr1993 it works fine for <a-f>, but I'm having troubles passing the exitInsertMode command.

I took this branch, merged #1140 into it, updated vimium options with the following mapping:
map e exitInsertMode
and created a rule to pass e key.

I enter insert mode with i, then I hit e and I'm back in normal mode, which is wrong. Same with <esc> being specified as a pass key.

@mrmr1993
Copy link
Contributor Author

@mrmr1993 it works fine for <a-f>, but I'm having troubles passing the exitInsertMode command.

To do this needed a patch after combining this PR and #1140. I've opened #1369 which integrates the change, it should work now there 😄

@mrmr1993
Copy link
Contributor Author

mrmr1993 commented May 7, 2015

@smblott-github this PR needs a rework, but is the idea a possibility? It's come back to mind based on #1560.

@smblott-github
Copy link
Collaborator

@mrmr1993. I'm not sure I'm seeing a use case compelling enough to warrant the additional code and (more importantly) UI complexity. On most sites (GMail, etc), the important shortcuts are simple (ie. non modified), and most Vimium bindings are simple too. It may be better to wait and see what use cases emerge.

@mrmr1993
Copy link
Contributor Author

mrmr1993 commented May 8, 2015

UI complexity

@smblott-github Surely the only UI change is adding a small note to the help text by exclusions/passkeys in the options page? Or am I missing something?

It may be better to wait and see what use cases emerge.

Could those requests for <esc> to be passed to the page count? That was the original use case I had in mind when making this. <c-[> is still hardcoded to behave as <esc>, so this would provide an easy fix for those.

@smblott-github
Copy link
Collaborator

Still not sure about this, @mrmr1993.

@smblott-github
Copy link
Collaborator

Closing, @mrmr1993.

I still don't think we should do this. Demand is weak. And we have passNextKey now (which helps).

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

Successfully merging this pull request may close these issues.

None yet

4 participants