Sunday, November 13, 2016

Atom (Open Source - Text Editor) Auto Indentation


Atom is an Open Source Text Editor. It supports couple of languages like Html, C#, Python, PHP, JavaScript and etc.  
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. 

Happy coding...!! 



No comments:

Post a Comment