Sublime Forum

Rebinding "enter" kills html end-tag autoindent

#1

I’m working on a plugin that rebinds the enter key in html files to enable more customized indentation. However, rebinding enter seems to have disabled one of the nice auto-indent features of ST2 that already worked for html.

Here’s an example. If you’ve just typed out

<div> hello </div

and then you press >, the closing tag will be automagically reindented to line up with the opening div tag.

This functionality seems to go away when I rebind enter, which makes little sense to me, since the above autoindentation doesn’t even mess with any newlines!

Test it yourself by remapping enter with

{ "keys": "enter"], "command": "my_enter", "context": { "key": "selector", "operator": "equal", "operand": "text.html"} ]}

So does anyone know how to either keep this useful autoindentation working or to replicate it?

0 Likes