Ctrl + M使用Sublime + Linux运行Makefile [英] Ctrl+M to run Makefile with Sublime+Linux

查看:205
本文介绍了Ctrl + M使用Sublime + Linux运行Makefile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在考虑从Pluma(以前的gEdit)切换到Sublime Text.到目前为止,我在Sublime Text上看到的效果都很好.

我当前正在测试Submlime Text 2,并且希望它在我按 Ctrl + M 时当前打开的文档文件夹中执行make. /p>

有可能吗?我该怎么办?

当我当前按下 Ctrl + M 时,它确实会构建我当前查看的LaTeX文档,但是它不使用我的Makefile.这很糟糕,因为它无法构建我的主文档,而这个主文档的构建过程更加复杂.

设置Tools > Build System > Make后,它将运行make,但不运行当前文档文件夹的Makefile.

我发现了,但它似乎专注于OS X.

解决方案

这个答案几乎是我所需要的:

执行以下步骤,使Sublime Text 2(ST2)在Linux下按 Ctrl + m 时执行make(在我的情况下:Linux Mint,基于Debian的发行版):

  1. 使用which make
  2. 获取make的路径
  3. 转到您的ST2用户配置目录
    /home/[Your user name]/.config/sublime-text-2/Packages/User
  4. 插入一个名为Make (Linux).sublime-build的文件,其内容如下.
  5. 在ST2中选择Tools > Build System > Make (Linux)

您可能会注意到ST2的路径与Shell中的路径不同.参见崇高文字2:自定义PATH和PYTHONPATH .

制作(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"]
      }
    ]
}

I'm currently thinking about switching from Pluma (former gEdit) to Sublime Text. What I have seen so far from Sublime Text is pretty nice.

I currently test Submlime Text 2 and would like it to execute make in the folder of the document that is currently opened when I press Ctrl + M.

Is that possible? How do I do it?

When I currently hit Ctrl + M it does build the LaTeX document I currently view, but it does not use my Makefile. That is bad, because it fails to build my main document which has a more complicated build process.

After setting Tools > Build System > Make it runs make, but not the Makefile of the current documents folder.

I've found this, but it seems to focus on OS X.

解决方案

This answer was almost what I needed:

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):

  1. Get the path of make with which make
  2. Go to your ST2 user config directory
    /home/[Your user name]/.config/sublime-text-2/Packages/User
  3. Insert a file called Make (Linux).sublime-build with the content from below.
  4. Choose Tools > Build System > Make (Linux) in ST2

You might notice that ST2 has a different PATH than you have in your shell. See Sublime Text 2: custom PATH and PYTHONPATH.

Make (Linux).sublime-build

You might have to adjust path to your needs. I've simply put the content of echo $PATH in this field (which is much more than the simple example from below).

{
   "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"]
      }
    ]
}

这篇关于Ctrl + M使用Sublime + Linux运行Makefile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆