How to replace a keymap binding


Yes, atom-workspace is valid for keymaps, though it would appear not for that one. It looks like everything for Tab is just atom-text-editor:not([mini]):

So you should probably just use that and leave out the atom-workspace.


Thanks for the response, but I was doing something wrong. My settings got reset and I had to add php and erb to the package’s settings.


Why is this so hard ?
All I want this to do seems incredibly simple in most Mac apps (hell the OS provides for it even if it is a menu item)
I want to set the Script plugin to run my current Python script file with Command R
This is pretty common on a Mac.
Command I should be “info” normally.
This Angular JS directive or whatever it is, pretty much the ONLY deal breaker.
This is the same crap that keeps me from using Sublime.
I like to use the keyboard shortcuts I know by convention that are similar across lots of Mac apps.
Back to TextMate.
There is a reason it is easy to use.


What do you have in your keymap.cson and what does the Keybinding Resolver tell you when you try to use those keybindings? If we know this, we can help you figure out why your keybindings aren’t working.

You can disable the default set of package keybindings by going to the package config/info page within Atom (Settings -> Packages and click on the grey box around the package info) and scrolling down to the keybindings. There’s a checkbox there that will disable the package’s keybindings, and you can define your own in keymap.cson.

This Angular JS directive or whatever it is, pretty much the ONLY deal breaker.

I’m not sure what this is referring to.


Thanks, I’ll look into it more. The “selectors” as they are are pretty dense and poorly (not centrally) documented or discoverable. I don’t have a lot of time to spend on it today. Nice thing is Atom has come along way since last I tried it out about 6 months ago.


You can see the selector for a language on its settings page. They’re not centrally located, no, and it would probably be useful to have scope names displayed on the grammar selector (in the spot where the keybindings are displayed in the Command Palette).


It would make sense to be able to see all (optionally)
Then search/filter them.
Inevitably conflicts or bugs or just unexpected behavior arise that can be difficult to trace. I’ve seen this with every polyglot editor.
Context / scope isn’t quite enough as those can be many and when the clash can be quite unpredictable.


There shouldn’t ever be a scope clash. Each TextBuffer is styled by only one grammar. That grammar may have other scopes embedded inside it, but as long as each grammar you have installed uses a unique name, you’re always going to know which scope you’re working with.


So I made that happen. I have a fork of the grammar-selector package that shows scopeName in the modal:

There is currently a pull request open, but it won’t be included in Atom for a few release cycles. If you would like to use it, you can go to the command line and run apm install damnedscholar/grammar-selector, then reload Atom. It will download the package to your .atom/packages directory and automatically override the built-in package until you delete it.


Be aware that installing a separate version of a built-in core package in the ~/.atom/packages directory is something for advanced users. Because this kind of thing has caused immense support headaches in the past, I’m working on building a system to warn people that this can cause problems in the near future.


I will probably disable that package immediately (I’ve had one or more core packages overridden for months) and feel briefly sad that I had to kill the dalek, but it seems like a very useful thing for when people come here asking questions. I like this plan. :smiley:


Well, my dalek package won’t complain if you launch Atom in Dev Mode because it assumes that in Dev Mode you know what you’re doing :grinning:


Very cool!!! (sorry for the exceptionally late reply) All we need now is that + shortcuts.



I’m facing similar problems and tried out all the solutions here, but it’s not working. Every time I’m trying to save the keymap.cson file, I’m getting a…
Failed to load /home/svub/.var/app/io.atom.Atom/data/keymap.cson
Duplicate key ‘atom-text-editor’.

I tried unset! on different namespaces, no success. My goal: to map Ctrl-H to jump to the left pane and Ctrl-L for the other direction - like I’m used to from VIM. First I installed vim mode plus but they use a very strange shortcuts: Ctrl-w l and Ctrl-w h which are both quite difficult to reach for using them all the time.

This is my keymap.cson with all the things I tried so far:

‘ctrl-h’: ‘unset!’


‘ctrl-l’: ‘unset!’

#‘body .native-key-bindings’:

‘ctrl-h’: ‘unset!’

#‘atom-workspace atom-text-editor’:

‘ctrl-l’: ‘unset!’

#‘atom-workspace atom-text-editor:not([mini])’:

‘ctrl-h’: ‘unset!’

#‘atom-workspace atom-text-editor:not([mini])’:

‘ctrl-l’: ‘unset!’


‘ctrl-h’: ‘window:focus-pane-on-left’


‘ctrl-l’: ‘window:focus-pane-on-right’

‘ctrl-h’: ‘unset!’
‘ctrl-l’: ‘unset!’

#‘atom-workspace atom-text-editor:not([mini])’:

‘ctrl-h’: ‘window:focus-pane-on-left’

‘ctrl-h’: ‘window:focus-pane-on-left’
#‘atom-workspace atom-text-editor:not([mini])’:

‘ctrl-l’: ‘window:focus-pane-on-right’

‘ctrl-l’: ‘window:focus-pane-on-right’

How can it be done? Hope somebody can help. :slight_smile:


When posting code you need to make sure to highlight it and press the </> button above the editor in order to format it as code.

The error message is pretty self-explanatory. You have two atom-text-editor keys when you should only have one. This is a CSON file, so you can have as many entries as you want under a single key, but you can’t have multiple keys with the same name at the same level. Each key is a folder and every entry is a file, so how are you going to find which folder your file is in if you have a bunch of folders with identical names?


Yes, it works, thank you!

I read the error “duplicate key” like “the key binding is already defined somewhere” so I was trying to unset it in any way I could imagine… it didn’t cross my mind that it’s referring to the format of the config file. But that might be only me.

Thank you very much for your quick answer!