atom / atom-keymap

Atom's selector-based keymap system
MIT License
105 stars 57 forks source link

Multi-keystroke patterns can't be created solely out of modifier keys. (like 'shift shift') #21

Open krilnon opened 10 years ago

krilnon commented 10 years ago

It's hard to tell if this is by design or not, but I wanted to make a double tap of the shift key open the autocomplete menu. This approach works for doubled special keys and character literals, so I expected it to work for modifiers too.

Doesn't work:

'.editor':
  'shift shift': 'command-palette:toggle'

Does work:

'.editor':
  'escape escape': 'command-palette:toggle'
'.editor':
  'x x': 'command-palette:toggle'

(I toggled the command palette in these examples but the same applies for autocomplete, etc.)

Is this broken or by design? And if it's by design, why?

Thanks! :hamster:

nathansobo commented 10 years ago

This is by design for now, but we may be able to support it. I excluded bare modifiers out of concern for ambiguity between the user hitting a modifier alone and the user hitting a modifier as part of a modified normal keystroke. When you press shift-a for example, there will actually be two keydown events, one for the shift and another for the shift-a. So bare modifier patterns would always end up matching the first keydown event and interfering with other modified bindings, which is probably not what you want.

I think we could probably match bare modifiers on keyup, when we can be sure there's no incoming modified keystroke.

adamclerk commented 9 years ago

I'd love to see this feature. I'm trying to do the same thing as @krilnon with the back to back shift.

msjyoo commented 9 years ago

+1 to this feature

bramcordie commented 9 years ago

Is it possible to configure around this design limitation? I'm used to double tapping ⇧ to launch Search Everywhere in PhpStorm. I would like atom to behave the same way with the following binding:

'.editor':
  'shift shift': 'fuzzy-finder:toggle-file-finder'
blmarket commented 9 years ago

Also IntelliJ(seems most of JetBrains IDEs) also supports :arrow_up: :arrow_up: to 'Search Everywhere'

ilyashubin commented 9 years ago

+1

cakebake commented 9 years ago

+1

blackfyre commented 9 years ago

:+1:

shaunhAU commented 9 years ago

+1

roelentless commented 9 years ago

+1

remcohh commented 8 years ago

+1

nunobaba commented 8 years ago

+1 Would it imply a lot of changes to implement this?

nathansobo commented 8 years ago

Would it imply a lot of changes to implement this?

The big problem is distinguishing intentional bare-modifier keystrokes from someone just hitting the modifier key immediately prior to another character... for example, we need to distinguish the sequence ctrl-a cmd-p from ctrl ctrl-a cmd cmd-p.

Recognizing the bare modifiers as their own keystroke beyond the first in the sequence creates ambiguity in this regard. It's potentially solvable by matching against both the sequence including bare modifiers and the sequence with the modifiers stripped, but doing so does involve enough changes that I can't take the time to dive in and figure it out right now.

jnmandal commented 8 years ago

+1

I have to context switch between IntelliJ and atom for work and I would love to add 'shift shift' into Atom.

nunobaba commented 8 years ago

@nathansobo Do you have any idea which part of the code is responsible for the keystroke detection? I might have the time to dive into it.

nathansobo commented 8 years ago

@nunobaba This is the line where we prevent handling of bare modifiers. You can follow the logic from there. It's going to take some creativity to allow multi-stroke bare modifier matches without interfering with ordinary matches. We currently just compare strings, for example, here. We could potentially perform a more sophisticated comparison where bare modifiers are selectively ignored.

agjs commented 8 years ago
harryPL commented 8 years ago

+1. I use the 'shift shift' in RubyMine all the time and it makes jumping between files really peachy.

vtambourine commented 8 years ago

Count me it! I am also long to use this WebStorm feature in Atom!

SavePointSam commented 8 years ago

+1 for implementation. Switch between Webstorm and Atom daily. Would like the single 'shift shit' key command for both. :D

chrisgorgo commented 8 years ago

+1

andrewhoff commented 8 years ago

+1 this would be awesome, currently just binding "ctrl-shift" to "project-find:show", then using Esc to get out. Can't use :toggle because the input context doesn't move to the find box, like it does in :show

mikebronner commented 8 years ago

looking for this as well. :) here's i what i'm using:

'.platform-darwin':
  'ctrl-shift': 'fuzzy-finder:toggle-file-finder
MikeJKBird commented 8 years ago

+1

krissik commented 8 years ago

+1

xenostar commented 8 years ago

+1

AndersonJo commented 8 years ago

Please support something like this.. (this one is used in Pycharm) '.platform-linux': 'shift shift': 'fuzzy-finder:toggle-file-finder'

AndersonJo commented 8 years ago

+1

CCristi commented 8 years ago

+1

overcache commented 8 years ago

+1

JBird608 commented 8 years ago

+1

MovingGifts commented 8 years ago

Any progress on this?

vladshcherbin commented 8 years ago

Oh, come on guys, two years since issue was created. We need this, is it that hard to implement?

50Wliu commented 8 years ago

@VladShcherbin: Yes it is, please see @nathansobo's comment above.

spurdow commented 8 years ago

bump +1

lordblendi commented 8 years ago

bump +1 pls

coxjc commented 8 years ago

Begging for this...

50Wliu commented 8 years ago

Thanks for the feedback everyone! However, all these +1s and bumps are just adding noise, so to minimize that I'm going to lock this issue for now – we may unlock it once someone starts working on this enhancement to get further feedback.