简体   繁体   English

需要帮助找到gedit的HTML,CSS,PHP代码格式化程序

[英]Need help in finding an HTML, CSS, PHP code formatter for gedit

I need help in finding an HTML, CSS, PHP code formatter plug-in for gedit. 我需要帮助找到gedit的HTML,CSS,PHP代码格式化程序插件。 I've looked into gmate and other plug-ins but I could only find code formatter for Ruby/Rails files. 我查看了gmate和其他插件,但我只能找到Ruby / Rails文件的代码格式化程序。

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: 要格式化HTML:

tidy -utf8 -i -w 80 -c -q -asxhtml

To format PHP: 格式化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 我在几年前写过博客: http//www.micahcarrick.com/gedit-html-editor.html

There's a list of all the plugins available for Gedit here . 还有所有可用的Gedit的插件列表在这里
It looks like one of their requested plugins is "Code autoformat": 看起来他们要求的插件之一是“Code autoformat”:

Code autoformat 代码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, eg, with gtk's style "if (foo) {" would automatically put the "{" in the next line and indent appropriately. 虽然键入样式是自动应用的,例如,使用gtk的样式“if(foo){”会自动将“{”放在下一行并适当缩进。 Not to be confused with templates (eg, as in Eclipse), no characters should be inserted automatically. 不要与模板混淆(例如,在Eclipse中),不应自动插入任何字符。 What to autoformat: do, for, if, while argument lists space between function name and left parenthesis add more here ... 什么是autoformat:do,for,if,while参数列出函数名和左括号之间的空格在这里添加更多...

So the feature(s) you're looking for might not be avaliable, just yet. 因此,您正在寻找的功能可能尚不可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM