Mac
菜單欄 -> Tools -> Developer -> new snippet…
新檔案的内容
<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>
修改第三行内容
<snippet>
<content><![CDATA[
String ${1}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>str</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.java</scope>
</snippet>
1、
${1}
進入頁面後, 光标移入的位置
2、
<tabTrigger>str</tabTrigger>
tab觸發的辨別 輸入
str
+ tab 自動補全 為
String
3、
<scope>source.java</scope>
生效檔案,此處在java檔案生效
4、儲存檔案為
str.sublime-snippet
回到java檔案,輸入
str
String
參考
sublime編輯器的一個使用小技巧: 自定義代碼片段