06創建自己的snippet

在:
C:\Users\kai\AppData\Roaming\Sublime Text 3\Packages\User
新建一個文件

可以存成這個文件名:
cc.sublime-snippet

里面這么寫:


<snippet>
    <content><![CDATA[
//USER NAME:          Renkai Wang
//FILE NAME:          $TM_FILENAME

#include <stdio.h>
#include <stdlib.h>
#include <string.h>    
#include <time.h>

int main(int argc, char const *argv[])
{
    ${1:/* code */}
    
    return 0;
}




]]></content>
<tabTrigger>cc</tabTrigger>
    <!-- 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>


這樣每次呼喚cc,就可以引出這樣的代碼段了。
大勝利!!


python的snippet


<snippet>
    <content><![CDATA[
# -*- coding:utf-8 -*-  
# USER NAME:          Renkai Wang
# FILE NAME:          hello.py
import os
import re
import sys
import os.path
import random

${1:coding...}
]]></content>
<tabTrigger>py</tabTrigger>
    <!-- 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>



cpp數據結構的


<snippet>
    <content><![CDATA[
//USER NAME:          Renkai Wang
//FILE NAME:          $TM_FILENAME
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <string>
#include <string.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <cmath>

using namespace std;

int main(int argc, char const *argv[])
{
    ${1:/* code */}
    return 0;
}



]]></content>
<tabTrigger>cpp</tabTrigger>
    <!-- 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>



最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容