Starting a new line without auto-indent


#1

Is there a keyboard combination to start a new line at the beginning of the line without disabling auto indent?

For trouble shooting, I usually put temporary code and comments at the beginning of the line, rather than indented with the rest of the code. This makes it easier to clean up afterwards.

Most of the coding editors I use have something like shift-enter for this, but I can’t find a reference to this anywhere. Maybe it’s there but I just don’t know that it’s called.


#2

Hmmm, I don’t believe so? There are a couple of commands that seem like they would do what you want if put together though - Editor: Newline Below and Editor: Move to Beginning of Line?

I put this in my init script:

atom.commands.add 'atom-text-editor', 'user:shift-enter-no-indent', ->
  return unless editor = atom.workspace.getActiveTextEditor()
  editor.insertNewline()
  editor.moveToBeginningOfLine()

And in my keymaps file:

'atom-workspace atom-text-editor:not([mini])':
  'shift-enter': 'user:shift-enter-no-indent'

So now with shift-enter, seems to do what you want?


#3

Brilliant! I didn’t know you could do that. Thanks