Need help in finding an HTML, CSS, PHP code formatter for gedit
I need help in finding an HTML, CSS, PHP code for开发者_如何学编程matter plug-in for gedit. I've looked into gmate and other plug-ins but I could only find code formatter for Ruby/Rails files.
The way I've done this in the past (though it's been years) is using the External Tools plugin. Essentially, install tested and true command-line utilities that can format the language you need formatted, in the way you like, and then put those commands into the External Tools plugin. Here are the commands I was using:
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 blogged about this years ago: http://www.micahcarrick.com/gedit-html-editor.html
There's a list of all the plugins available for Gedit here.
It looks like one of their requested plugins is "Code autoformat":
Code autoformat
Automatically apply a chosen coding style while typing. A plugin that lets the user select a coding style (or even pull it from the mode line if possible). While typing the style is applied automatically, e.g., with gtk's style "if (foo) {" would automatically put the "{" in the next line and indent appropriately. Not to be confused with templates (e.g., as in Eclipse), no characters should be inserted automatically. What to autoformat: do, for, if, while argument lists space between function name and left parenthesis add more here ...
So the feature(s) you're looking for might not be avaliable, just yet.
精彩评论