I have installed the atom-shortcuts add-on in Atom, but I can't use the shortcut to toggle the cheatsheet because of my keyboard layout, so I would like to change the keybinding for this add-on but I can't find it by name in the keybindings section of Atom. Where can I find the information necessary to change the keybinding of this add-on?
The problem with this particular package is that it doesn't follow the standard way to assign keybindings, i.e. by providing a CSON (or JSON) file inside the /keymaps
subfolder. Instead, the package assigns the keybinding programmatically. It also does not register commands that are triggered by keybindings in its activate()
method.
Unfortunately, that's a combination that makes it impossible to re-assign keybindings the “Atom way”. Unless you can convince the author to re-implement command registration and keybinding assignment (or fork the package yourself), there's only one last resort: use the same dirty tricks to change the package's behaviour.
You can put the following CoffeeScript snippet in Atom's init script file:
# Get the selector for the atom-shortcuts element
atomShortCuts = document.querySelector "div.atom-shortcuts"
# Assign a custom keydown event
document.body.addEventListener 'keydown', (event) ->
# Pick a shortcut, Ctrl+Shift+S in this example
if event.ctrlKey and event.key is 'S'
atomShortCuts.style.display = 'block'
return
I recommend reading MDN's documentation for KeyboardEvent if you want your keybinding to behave differently. CSS Tricks has a helpful testing tool for keyboard events.