Using keybindings quickstart


I have added entries to keymap.cson and they are not respected. It seems they were being “hidden” by selectors in other mapping files …

Here is the specific example:

  'cmd-d': 'editor:delete-lines'

It seems to have been overridden by “Find-and-replace: select next”

Well I want to remap that one to command G … And this process becomes unwieldy pretty quickly.

Is there any “shortcut” to … "hey - I want to use this shortcut for this operation … everywhere.

I dumped sublime text due to their difficult approach to custom keymappings. I hope not to do the same with atom.


In short, no, there currently is no easy way to force a keybinding to be respected everywhere. My recommendation is to take the keybinding you are trying to override and use its selector to override it. For example for find-and-replace:select-next it is .platform-darwin atom-text-editor. Fortunately it is the same selector for find-and-replace:find-next. Which would result in:

'.platform-darwin atom-text-editor':
  'cmd-d': 'editor:delete-lines'
  'cmd-g': 'find-and-replace:select-next'


Thanks ! I put those into keymap.cson, restarted atom - and command-d did not do anything AFAICT[quote=“leedohm, post:2, topic:25234”]
’.platform-darwin atom-text-editor’:
‘cmd-d’: ‘editor:delete-lines’
‘cmd-g’: ‘find-and-replace:select-next’

I tried the above again. It does nothing: that is the precise code you suggested. What is going on here? One question: it has been awhile since my original post and do not recall: what is the file path / location to the keymap.cson? I want to ensure editing the correct place. So far no evidence the file were being used at all.


Are you running a Mac? Or are you on another platform?

Also, have you tried using the Keybinding Resolver (Cmd+. on OS X and Ctrl+. on other platforms)? It will show you what key Atom saw you press and the command that was triggered because of it.

(It is also mentioned in the Debugging section of the Atom Flight Manual.)