收集的有关sublime有关资料

sublime text2增加浏览器预览(转载)

http://www.csser.com/board/4f8f77ceb86d3673360007b6

Sublime Text 2 入门及技巧

http://www.cnblogs.com/BiffoLee/archive/2011/11/26/2264198.html

Sublime Text 2 编辑器实用技巧

http://www.csser.com/board/4f59c2cb9c3694f227001cd7

Sublime Text 2 小技巧和小诀窍

http://ihacklog.com/post/sublime-text-2-tips-and-tricks.html

Sublime Text] Sublime Text 2 入门及技巧 

http://blog.sina.com.cn/s/blog_7ff92cc501011q06.html

http://guangqiang.iteye.com/blog/1766592

代码片段

写代码,都少不了自己一些常用的代码片段,Sublime Text也提供了设置代码片段的方法。

在Tools->New Snippet 中可以新建自己的代码片段

2 Sublime Text 2 使用及插件介绍

新建snippet会默认显示如下代码,可以这个为模板进行修改。

1
2
3
4
5
6
7
8
9
<snippet>
    <content><![CDATA[
Hello, ${1:this} is a ${2:snippet}.
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <!-- <tabTrigger>hello</tabTrigger> -->
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <!-- <scope>source.python</scope> -->
</snippet>

使用时,先取消注释的内容。

content标签包含的内容就是需要显示的代码片段。其中${1:this} 是表示产生代码片段后,光标停在this这个位置。${2:snippet}表示,产生代码片段后,按tab健光标跳到 snippet位置。

tabTrigger标签 相当于快捷键,比如上面代码hello:输入hello然后按tab键即可显示content标签的内容。

scope标签可选,默认不写则对所有文件格式生效,如果设置了,则对相应的文件或文件格式生效。

最后设置好后, 将文件保存在”packages/User”目录下,以sublime-snippet为扩展名。重启sublime text 2,该snippet即可使用了。

关于snippet的详细内容可参看文章:http://sublimetext.info/docs/en/extensibility/snippets.html

原文地址:https://www.cnblogs.com/vico/p/2912564.html