Select All Then Auto Indent


So I want to make a keyboard shortcut to first select all the text and then auto indent it.

This is my code for the
atom.commands.add ‘atom-text-editor’, ‘custom:auto-format’, ->
editor = atom.workspace.getActiveTextEditor()

And this is my code for the keymap.cson
‘ctrl-shift-f’: ‘custom:auto-format’

Now when I try to use the shortcut, nothing happens. Can someone help please.

Thanks, Popolok


For the changes to take effect, the software must be restarted.
Did you do this yet?

Ctrl+Shift+F5 is the “soft” restart.
Else the “hard” restart is to close Atom and re-open it.

See is the following code helps you:

atom.commands.add 'atom-text-editor', 'custom:auto-format', ->
	return false unless _editor = atom.workspace.getActiveTextEditor()



So doing the soft reset gave me this error.
Uncaught ReferenceError: core is not defined

But the code fixed the problem

Thank you


There’s no core variable. Any globals provided by Atom are under atom, such as atom.workspace and atom.commands.