Sublime Forum

How to auto load package to format?

#1

I am pretty new to sublime text (actually 3-day since using it, notepad++ user prior). I am using Sublime Text 3 build 3143. I have “indent xml” and “Pretty JSON” packages installed. Like the app so far!

Even with the packages installed, I still have to manually activate the formatter for xml and json file to have proper format. I am wondering if it is possible to have the formattor package to perform format automatically once opened the file.

Thanks,
/S

0 Likes

#2

for some reason this feature isn’t built in to these plugins, despite it being a super useful addition to have
I wrote a small plugin to get auto formatting when opening files using a similar plugin, https://packagecontrol.io/packages/IndentX, though, maybe you can adapt it to use those plugins you installed

Pretty JSON does have a setting pretty_on_save though, so you could open a file and save it straightaway

0 Likes

#3

Thanks, is your plugin also do validation of JSON?

BTW, also tried your plugin but somehow it does not auto format json after openning the file…Might be I missed something.

0 Likes