Sublime 的一些简单配置

upd2: VSC真香 upd: i love vim!! i love vim!! i love vim!!

世人都说vim天下第一….

emmm 这句话没毛病

可是monokai颜值也太高了把!!?!

本来和dqy说好一起暑假用vim,然后我在暑假前被sublime的monokai勾引,dqy被material配色+JB的CLion(他认为JB大厂颜值天下第一)所勾引….然后就emmmm….虽然vim可以配置monikai和material,但是我们后来都很少用vim把(至少我是很少用

这文章简单copy一下sublime 在win和ubuntu下我个人配置,主要写给我自己看…

Win

g++环境下编译

1.安装g++

2.打开sublime软件,依次打开:Tools—>Build System—>New Build System

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{   
"encoding": "utf-8",
"working_dir": "$file_path",
"shell_cmd": "g++ -std=c++11 \"$file_name\" -o \"$file_base_name\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"selector": "source.c++",
"variants":
[
{
"name": "Run",
"shell_cmd": "g++ -std=c++11 \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\""
}
]
}

3.保存为g++.sublime-build     ,该文件在sublime的 Packages/User 文件夹下

自制快捷头文件(有时间作者信息)

1.插件放置地址,工程路径:Tools → Developer → New Plugin 保存名字为 addInfo.py 粘贴以下代码:contents中为你想写的内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import datetime
import sublime_plugin
class AddInfoCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.run_command("insert_snippet",
{
"contents":"/***********************************************""\n"
" * @Author: miniLCT""\n"
" * @DateTime: " "%s" %datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+"\n"
" * @Description: You build it, You run it. ""\n"
" ***********************************************/\n"
"#include <bits/stdc++.h>\n"
"#define ll long long\n"
"const int maxn = 1e6+10;\n"
"#define eps 1e-8"
"\nusing namespace std;\n"
"int main()\n"
"{\n \n}"
}
)

效果图
2.Preference → Key Bindings 在User处添加如下代码

1
2
3
4
5
6
7
8
9

[
{
"command":"add_info",
"keys":[
"ctrl+shift+."
]
}
]

这样只要用ctrl+shift+.   就可以插入你预先设计的内容了。还是蛮方便的??

emmmm   突然想起cls那句话: 打acm用什么插件

trx那句 :快弃了把,用vim

Ubuntu

回校以后再更叭

Snippet代码块

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<snippet>
<content><![CDATA[
/*************************************
* Author : miniLCT
* More : You build it. You run it
************************************/
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <cstdio>
#define ll long long
#define INF 0x3f3f3f3f
#define FOR(i,f_start,f_end) for(int i=f_start;i<=f_end;++i)
#define MT(x,i) memset(x,i,sizeof(x))
#define close std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=1000000009;
const ll mod = 1e9 + 7;
const double PI = acos(-1.0);
const double E = exp(1);
const double EPS=1e-8;
const int maxn = 1e6+10;
int main()
{
${1:}
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>poj</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>

保存为poj.sublime-snippet

-------------本文结束感谢您的阅读-------------