本文共 1411 字,大约阅读时间需要 4 分钟。
CodeFormatter插件用来对代码进行格式化,使用方式,快捷键 ctrl+alt+f
codeformatter是Sublime Text 2 / 3的插件,支持格式(美化)源代码。
CodeFormatter支持的语言:下载方式:将Git源代码,clone到Sublime Text插件目录
Git地址:
https://github.com/akalongman/sublimetext-codeformatter.git
PackageControl官网地址:
更多插件地址:
特别注意,对于HTML格式化的配置:
"codeformatter_html_options": { "syntaxes": "html,blade,asp,xml", // Syntax names which must process HTML formatter "format_on_save": true, // Format on save "formatter_version": "regexp", // Which formatter to use. Current options are "bs4" and "regexp". If an error occurs while loading the bs4 formatter, the regexp formatter will automatically be used "indent_size": 4, // indentation size "indent_char": " ", // Indentation character "indent_with_tabs": true, // Indent with one tab (overrides indent_size and indent_char options) "exception_on_tag_mismatch": false, // If the last closing tag is not at the same indentation level as the first opening tag, there's probably a tag mismatch in the file "expand_javascript": true, // (Under construction) Expand JavaScript inside of
1. 格式化模式使用regexp比较理想
"formatter_version": "regexp",
2.启用保存时格式化,很不错
"format_on_save": true, // Format on save
更多插件: