Atom (Open Source Text Editor) Auto Indentation

I would like to share how to perform Auto Indentation in Atom.

Step 1: Open File- Init Script - Paste below code

atom.workspace.observeTextEditors (editor) ->
editor.buffer.onWillSave ->
return if editor?.getGrammar()?.scopeName is 'source.coffee'
editor.autoIndentBufferRows 0, editor.getBuffer().getLineCount() - 1


Step 2: Open File- Key map - Paste below code

'atom-text-editor':
'ctrl-alt-l': 'editor:auto-indent'


Once you finish with both the steps, please restart your Atom.

Now whenever you write some code and press “Ctrl + S" key, your code will be auto indented.