Auto-indent key binding not working. RESOLVED


Hi, I’ve just installed ATOM but unable to get auto-indent working with a keybinding. Have been working on this for an hour. Did something change in the latest version?

I have this

  'alt-cmd-l': 'editor:auto-indent'

in ‘your keymap’ keymap.cson

and I select all in my editor, but it does nothing. If I select auto-indent from the menu it DOES work. I tried mapping to other keys but nothing works. Have tried everything I can think of and googled for answers for an hour. I’ll pay someone to solve this for me! have been using WebStorm for Meteor dev and love it. Thought it’d try Atom but so far I cannot say I’m impressed if auto-indent cannot be binded to a key!


I suspect you’re running into the same problem as described here:


but in my case it’s a new, virgin keymap file with only a single entry

   'alt-cmd-l': 'editor:auto-indent'

Are there any other steps? like do I need to enable the keymap file? Or set it in my preferences? or save it with another name or anything?


do I need to be very careful with the indent? is this coffeeScript formatting? what are the rules?
no spaces for first line? two spaces for second line?


seems that was it! I added a space before the first line and now it’s working. pfft


Yes, all the files that end in .cson are CoffeeScript Object Notation files. They’re just like JSON, but they follow CoffeeScript notation. You can find more information on CoffeeScript object literals here:


wow, what in the world were they thinking? This needs to be mentioned in the # Your keymap comments

Warn new users we are using a little known format (cson), not the more popular json doc notation

+# Bindings not working? Be aware that cson follows CoffeeScript notation with differs with json. 


I’m having this problem, too. However I’m pretty sure my formatting is fine.

I’m using the same settings I was using before upgrading to OS X Yosemite (which were working). The other keybindings in the same context are working properly. Plus, when I look in the menu (Edit > Lines > Auto Indent), it shows the keybinding I set.

Here’s my keymap.cson (excluding the opening comments that are there by default):

  'alt-down': 'emmet:decrement-number-by-1'
  'alt-up': 'emmet:increment-number-by-1'
  'shift-cmd-r': 'editor:auto-indent'
  'f5': 'sort-lines:sort'
  'shift-f5': 'sort-lines:reverse-sort'

".autocomplete-plus input.hidden-input":
  "enter": "autocomplete-plus:confirm"


maybe try changing it all to single quotes?

Sometimes I found you can just delete it all and paste it in again. Also watch out for trailing spaces (maybe).

CSON is a joke. No one is using it. Can’t find a single online CSON validator.


This might help. Try and validation your CSON by checking if the JSON validates

Convert CSON to JSON using the tool below, then validate the JSON with one of the many JSON validators.


ah, didn’t notice those double-quotes. must’ve copy + pasted that one from somewhere. didn’t fix my problem, though.

also, either that CSON -> JSON tool doesn’t work properly, Atom doesn’t use valid CSON for keymaps, or there’s something I’m missing… The contexts don’t become arrays, though.


Having just discovered safe mode (atom --safe in Terminal), I gave that a go and it works properly. I must have a package interfering somewhere. Is there a good way to narrow that down so I don’t have to disable them one by one?


Subscribe to this bug for updates on the tool that’s been proposed for this purpose:


Cool idea. Thanks! I really appreciate your help. I think you’ve responded to every single issue I’ve posted on this site.


If you have this issue in windows remove ‘cmd’
‘alt-l’: ‘editor:auto-indent’