Commands not executing on keybind, but are executing from command pallet


#1

Got an issue with keymapping commands:

Watch this youtube video to see the bug…

As you can see in the video, when I call the commands by keyboard shortcut:

On the first attempt - the function isn’t called.
On the second attempt - the function is called.

On the other hand, when I call the commands via the command pallet, the commands are called even on the first attempt. And continue running without fail.

This leeds me to believe there is something wrong with my keymap.coffee:

'.editor:not(.mini)':
  'shift-cmd-h': 'hex:view'
  'alt-down':'editor:add-selection-below'
  'alt-up':'editor:add-selection-above'
'.editor':
  'cmd-k':'jxa:compile'
  'shift-cmd-k':'jxa:compileApp'
  'cmd-u':'jxa:execute'

However I can see nothing clearly wrong here… So perhaps there’s something wrong with my init.js?

Any ideas?


#2

Open the keybinding resolver (keybinding-resolver:toggle) and see what appears when you try to use the key sequence.


#3

Odd things…


#4

It’s almost as if atom doesn’t find the command the first time round, and pressing the key again, it suddenly finds the keybinding…


#5

Okay, no. It’s because cmd-k is bound to so many things. Go into Settings -> Keybindings and search for it and you’ll see a lot of different things attached to it that are all bindings with multiple key presses. So when you press cmd-k, Atom waits to see what your next key press will be. You should consider using something different for jxa:compile.


#6

Ah… Well that’s a pain, but indeed that did fix it!

Thanks!


#7

Yeah, you’re not the first to run into that prefix key