6

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.

Community
  • 1
  • 1
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
  • That answer you linked to is the answer you need. You will need to change the path accordingly. The answer says to save it as `Make (OSX).sublime-build`, you can cut (OSX) out or just put (WIN) instead. – Ryan B Feb 12 '14 at 03:48
  • 1
    @RyanB: I've tried it again and it worked now. The problems were a missing `,` in the code provided in the other question and `PATH` issues. – Martin Thoma Feb 12 '14 at 06:13

1 Answers1

7

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"]
      }
    ]
}
Community
  • 1
  • 1
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958