在:
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>