调出cpp.json
在左下角点击【设置】→【用户代码块】,在弹出的搜索筐中选中【cpp】语言
由于我已经有了cpp.json这里输入python作为示例,
注意一点:模板中$0
表示生成用户模板后,光标所在位置,其他的都好理解
然后新建new.cpp文件,输入cpp,按下enter即可完成
cpp模板
"Print to conaole":{
"prefix": "cpp",
"body": [
"#include <iostream>",
"#include <string>",
"",
"using namespace std;",
"",
"int main(int argc, char** argv)",
"{",
" $0",
" return 0;",
"}",
"",
],
"description": "This a c++ template."
}
c模板
"Print to conaole":{
"prefix": "c",
"body": [
"#include <stdio.h>",
"#include <stdlib.h>",
"#include <string.h>",
"#include <unistd.h>",
"#include <pthread.h>",
"#include <fcntl.h>",
"",
"int main(int argc, char** argv){",
" $0",
" return 0;",
"}",
"",
],
"description": "This a c template."
}