在:
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,就可以引出這樣的代碼段了。
大勝利i艹佟辫呻!
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數(shù)據(jù)結(jié)構(gòu)的
<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>