sublime text 2 安装,配置

安装:

1
2
3
sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text

包管理器: https://packagecontrol.io/installation#st2

Build System:

在OS X 中使用Sublime Text编译和运行C/C++。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && osascript -e 'tell application \"Terminal\" to activate do script \"clear&&cd \\\"${file_path}\\\"&&\\\"${file_path}/${file_base_name}\\\" && echo \\\"Finished \\\"${file_base_name} &&exit\"'"],
"file_regex": "^(..[^:]*):([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}' && '${file_path}/${file_base_name}'"]
}
]
}

iTerm运行C/C++程序:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && osascript -e 'tell app \"iTerm\"' -e 'set newWindow to (create window with default profile command \"/bin/zsh\")' -e 'tell current session of current window' -e 'write text \"clear && cd \\\"${file_path}\\\"&&\\\"${file_path}/${file_base_name}\\\" && echo \\\"Finished \\\"${file_base_name}\"' -e 'end tell' -e 'end tell'"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++, source.cpp",

"variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
}
]
}