The way I did this in the past (although these were years) uses the External Tools plugin. Essentially, install tried and true command line utilities that can format the language you need to format as you like, and then put these commands in the External Tools plugin. Here are the commands I used:
To format HTML:
tidy -utf8 -i -w 80 -c -q -asxhtml
To format PHP:
php_beautifier -s4 -l "ArrayNested() IndentStyles(style=bsd) NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT)"
I wrote about this many years ago: http://www.micahcarrick.com/gedit-html-editor.html
source share