这个答案 https://stackoverflow.com/a/13827685/562769几乎就是我所需要的:
Do the following steps to make Sublime Text 2 (ST2) execute make
when you hit Ctrl + m under Linux (in my case: Linux Mint, a Debian based distribution):
- 获取路径
make
with which make
- 转到您的 ST2 用户配置目录
/home/[Your user name]/.config/sublime-text-2/Packages/User
- 插入一个名为
Make (Linux).sublime-build
与下面的内容。
- Choose
Tools > Build System > Make (Linux)
in ST2
您可能会注意到 ST2 的 PATH 与您在 shell 中的路径不同。看Sublime Text 2:自定义 PATH 和 PYTHONPATH https://stackoverflow.com/q/8574919/562769.
制作 (Linux).sublime-build
你可能需要调整path
满足您的需求。我只是简单地把内容echo $PATH
在这个领域(这比下面的简单例子要多得多)。
{
"cmd": ["make"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "source.makefile",
"path": "/usr/bin/:/usr/local/texlive/2013/bin/i386-linux",
"variants":
[
{
"name": "Clean",
"cmd": ["make", "clean"]
},
{
"name": "Test",
"cmd": ["make", "test"]
}
]
}