Home Download Buy Blog Forum Support

Rebinding "enter" kills html end-tag autoindent

Rebinding "enter" kills html end-tag autoindent

Postby mtaran on Wed Dec 12, 2012 8:12 am

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

Code: Select all

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

Code: Select all
  { "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?
Posts: 10
Joined: Fri Sep 07, 2012 10:02 pm

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 19 guests