首页 > Web开发 > 详细

Sublime Text 2 HTML代码缩进 美化HTML代码

时间:2015-10-12 10:31:56      阅读:395      评论:0      收藏:0      [点我收藏+]

      关于代码格式的美化,之前在win下一直用“alignment”这个插件,它能实现一键对齐和缩进。最近使用mac版的sublime text 2,不知道是什么原因,这个插件疑似失效…… 这对有洁癖的完美主义者简直是沉重的打击啊!

  So,只能寻找其他的替代方法了。在package control的帮助下,找了几个美化HTML代码的插件,可惜效果都不尽如人意啊。天无绝人之路,借助强大的谷(bǎi)歌(dù),终于找到了解决方法,原文如下

You don‘t need any plugins to do this. Just select all lines (CtrlA) and then from the menu select Edit → Line → Reindent. This will work if your file is saved with an extension that contains HTML like .html or .php.

If you do this often, you may find this key mapping useful:

{ "keys": ["ctrl+shift+r"], "command": "reindent" , "args": { "single_line": false } }

If your file is not saved (e.g. you just pasted in a snippet to a new window), you can manually set the language for indentation by selecting the menu View → Syntax → language of choice before selecting the reindent option.

班门弄斧,帮大家翻译一下:

你不需要使用任何插件就能解决这个问题。如果你已经把包含html代码的文件之扩展名保存为.html或.php,只需全选所有行(Ctrl+A),然后从菜单选择“Edit → Line → Reindent”,就好了。如果你经常用到,你可以找一下这个有用的按键映射:

{ "keys": ["ctrl+shift+r"], "command": "reindent" , "args": { "single_line": false } }

如果你的文件还没保存(例如你刚把一段代码粘贴到一个新窗口),在执行重新排版命令前,你可以通过点击菜单“View → Syntax → 要选择的语言”来设置想要缩进的语言。

Sublime Text 2 HTML代码缩进 美化HTML代码

原文:http://www.cnblogs.com/haries/p/4870769.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!