Add autoindentation to emacs

If you hit Ctrl+J, instead of Enter, you get ‘Newline+Indent’. If you like the feature, you can permanently add this to emacs defaults by adding the following to your ~/.emacs

(define-key global-map (kbd "RET") 'newline-and-indent)

Read more here and here.