Adding electric-pair support so when user types brackets, it will automatically be indented.
Moreover, the current indent detecting logic has flaw, the "\s-" regex also matches newline. Therefore, when types anything before closing parent, the indentation will be wrong (promote one level).
For example
function a
{
DoSomethingAndPressEnter()
| // ----> The cursor will be here
}
it should be
function a
{
DoSomethingAndPressEnter()
| // ----> The cursor should be here
}
This PR fixes that too.
Also, Emacs advises that TAB key should not be rebind unless necessary (docs for indent-line-function), I removed the tab key rebinding too.
Adding electric-pair support so when user types brackets, it will automatically be indented. Moreover, the current indent detecting logic has flaw, the "\s-" regex also matches newline. Therefore, when types anything before closing parent, the indentation will be wrong (promote one level). For example
it should be
This PR fixes that too.
Also, Emacs advises that TAB key should not be rebind unless necessary (docs for
indent-line-function
), I removed the tab key rebinding too.