Sublime Text3 for MAC 配置C++并自定义编译运行快捷键
-
T
o
o
l
s
Tools
Tools
⇒
\Rightarrow
⇒
B
u
i
l
d
S
y
s
t
e
m
Build System
BuildSystem
⇒
\Rightarrow
⇒
N
e
w
B
u
i
l
d
S
y
s
t
e
m
New Build System
NewBuildSystem
- 将新窗口中的代码替换成如下代码并保存,注意路径使用默认路径
配置代码:{ "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}'"], "file_regex": "^(..{FNXX==XXFN}*):([0-9]+):?([0-9]+)?:? (.*)$", "working_dir": "${file_path}", "selector": "source.c, source.c++", "variants": [ { "name": "Run", "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}'&& osascript -e 'tell application \"Terminal\" to activate do script \"clear&&${file_path}/${file_base_name} &&exit\"'"] } ] }
-
S
u
b
l
i
m
e
T
e
x
t
Sublime Text
SublimeText
⇒
\Rightarrow
⇒
P
r
e
f
e
r
e
n
c
e
s
Preferences
Preferences
⇒
\Rightarrow
⇒
K
e
y
B
i
n
d
i
n
g
s
Key\ Bindings
Key Bindings
- 在右边窗口中输入如下内容(我这里设置的是F11快捷键编译运行,可以根据习惯自定义,只要不冲突就好了)
代码:[ { "keys": ["f11"], "command": "build", "args": {"variant": "Run"} } ]