Sublime Forum

Macro for triggering full-buffer syntax format?

#1

I am using Submlime Text 2 to do a lot of JavaScript writing/editing. One feature I love in Visual Studio 2010 is that, upon entering a ; or a terminating }, the buffer is formatted for indentation, etc (only works if there are no syntax errors). I’d like to do the same with Sublime. I have the JsFormatter plugin installed, and bound to a key, but am not sure how to go about triggering this action whenever a ; or } are pressed.

0 Likes

#2

docs.sublimetext.info/en/latest/ … acros.html

Just create a macro that:

  • inserts }
  • activates jsformat

then bind that to }

repeat for ;

0 Likes