关于代码格式的美化,之前在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 → 要选择的语言”来设置想要缩进的语言。

最新文章

  1. Spring注解@Resource和@Autowired区别对比
  2. 技巧分享:解决Word 2010当中“分页符”造成的空白行
  3. 关于博弈论中的一硬币正反问题的分析<二>
  4. 了解HTML表单之input元素的23种type类型
  5. javascript原型Prototype【转】
  6. 【Android 】Service 全面总结
  7. ios6 处理内存警告
  8. UIWindow详解
  9. 【转】Beaglebone Black
  10. (四)《Java编程思想》——可变参数列表
  11. [转]Installing Snow Leopard (Client) on VMware Fusion 6.0.3
  12. 微服务架构介绍和RPC框架对比
  13. Using RequireJS in AngularJS Applications
  14. ES6基础(二)
  15. 使用loadrunner录制手机脚本
  16. Codeforces 1120D Power Tree [最小生成树]
  17. R-CNN,SPP-NET, Fast-R-CNN,Faster-R-CNN, YOLO, SSD, R-FCN系列深度学习检测方法梳理
  18. 浅谈pc和移动端的响应式
  19. Microsoft.AspNet.Identity 重置密码
  20. IdentityServer4-从数据库获取User进行授权验证(五)

热门文章

  1. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [spring/applicationContext-service.xml]: Cannot resolve refer
  2. ethereum(以太坊)(十二)--应用(二)__投票(基础总和)
  3. PyQuery网页解析库
  4. stark组件(7):增加分页功能
  5. PHP.30-TP框架商城应用实例-后台6-商品会员价格删除-外键,级联操作
  6. PHP.27-TP框架商城应用实例-后台4-使用Gii生成品牌表的代码
  7. HDU 4405 Aeroplane chess(期望dp)
  8. Spring Boot :Request请求处理流程
  9. spring里面的context:component-scan
  10. shell编程——参数传递