Use electric-indent-mode for indentation
Quit to normal mode with qq

Trying to substitute ESC