Questions tagged [sublime-build]

Sublime Text is a cross-platform text and source code editor written by Jon Skinner. One of its features is customizable build systems, allowing for the processing of files through external programs such as compilers, interpreters, and formatters, without leaving the editor.

Build systems let you run your files through external programs without leaving Sublime Text, and see the output they generate.

Build systems configurations are stored in .sublime-build files. These JSON files can contain various keys:

  • selector: allows Sublime Text to find the build, looking for the current file extension
  • target: Sublime Text command to run (by default exec)
  • variants: allows you to provide build options
  • windows: OS-specific configuration
  • linux: OS-specific configuration
  • osx: OS-specific configuration
  • cmd: the command to execute when F7 is pressed
  • file_regex: Perl regex to capture output of cmd
  • line_regex: Perl regex to capture output of cmd
  • working_dir: directory to change the current directory before running cmd
  • encoding: output encoding of cmd
  • env: dictionary of environment variables to be merged before passing them to cmd
  • shell: if true, cmd will be run through the shell
  • path: will replace the current process' PATH before calling cmd
  • syntax: output syntax for highlighting purpose

Here is a simple build, used to run the sass command for .scss and .sass files:

{

    "cmd": [
        "sass",
        "--update",
        "--stop-on-error",
        "--no-cache",
        "--load-path", "${file_path}",
        "--sourcemap=none",
        "$file:../${file_base_name}.css"
    ],

    "selector": "source.sass, source.scss",
    "line_regex": "Line ([0-9]+):",

    "osx": {
        "path": "/usr/local/bin:$PATH"
    },
    "windows": {
        "shell": "true"
    }

}

Links

50 questions
23
votes
5 answers

Can't send input to running program in Sublime Text

I'm trying to get Sublime Text 3 to run a Python script. A simple two liner var = raw_input("Enter something: ") print("You entered " + var) which asks for input, waits for it, then prints it out in windows console prompt. Seeing the number of…
Rook
  • 60,248
  • 49
  • 165
  • 242
6
votes
1 answer

Setting environment variables for Sublime Text on OSX desktop

I'd like to be able to access my JAVA_HOME variable that has been set in my .bash_profile from within my sublime text build. When I build I get the following error. Error: JAVA_HOME is not defined correctly. We cannot execute .... This is…
alexrogers
  • 1,514
  • 1
  • 16
  • 27
4
votes
0 answers

How to invoke cmake from within sublime text?

I'm using: sublime text 3 cmake make on Mac and mingw-make on windows So far I'm able to compile and run hello world using cmake and make. I'd like to be able to compile, link and run from within sublime text. By default, I didn't find a build…
brainydexter
  • 19,826
  • 28
  • 77
  • 115
2
votes
1 answer

Sublime Build with SublimeREPL and Python 3

I am attempting to run Python 3 code in Sublime Text 3 while also automatically opening a Python console which is interactive and reusable (using the Sublime package SublimeREPL). I have used the solutions provided here: Set up Python 3 build system…
2
votes
1 answer

Sublime Text shows "NUL" characters in build output

I've coded a simple Red "Hello world" program in Sublime Text 3: Red [] print "Hello world!" I've also created a build system that I'm trying to use to compile and run the program, where G:\Red Programming Language\redlang.exe is the Red…
Aaron Christiansen
  • 11,584
  • 5
  • 52
  • 78
2
votes
1 answer

Custom Sublime Text Buildfile, GHCi, Haskell

I'm trying to create a custom sublime-build file in MacOS Yosemite, that will execute ghci on console with my code preloaded. That will make my Haskell learning process faster and enjoyable. However, since I'm new to Haskell and Sublime Text, I have…
user1563544
  • 379
  • 3
  • 17
2
votes
1 answer

Why doesn't sublime automatically detect this custom sublime-build with a selector?

I have the following saved to node-sass.sublime-build in my User folder { "shell_cmd": "node-sass.cmd $file", "selector": "source.scss" } I have a slideEditor.scss file. If I explicitly set the build system to node-sass, ctrl+b works just…
George Mauer
  • 117,483
  • 131
  • 382
  • 612
1
vote
0 answers

Compiling from Sublime Text (Windows 10): g++: command not found

I have created a C++14.sublime-build file from tools>Build System>New Build System. The code that I placed inside is: { "cmd":["bash", "-c", "g++ -std=c++14 -Wall '${file}' -o '${file_path}/${file_base_name}' &&…
rgv
  • 61
  • 10
1
vote
2 answers

How to setup sublime 3 build for C++ with multiple files

First of all, I'm a total noob on SO, so please go easy on me :) That being said, my question might be really easy to answer: How would I use sublime text 3 for c++ with multiple files (header/implementation files) I've been trying some build…
1
vote
0 answers

Sublime text 3 MinGW build

I've been trying to build sublime text 3 for competitive programming and am getting confused about build systems. I've tried various build systems from the net and some start the console for i/o ,some show some error and don't work. I have…
1
vote
2 answers

Show Java program output on cmd after compiled by Sublime text 3

I'm using Sublime Text 3 for writing and compiling my java programs but the output on Sublime console isn't helpful because we can't give inputs. I had found the sublime build code for C and C++ to show the output on cmd but haven't succeeded in…
G Ajeet
  • 27
  • 5
1
vote
1 answer

file_regex breaks sublime build

This regex works in the SublimeText search field: ([^\/]+\.java) If I use that regex in a .sublime-build file: \. is highlighted in red, and the build system is not recognised. When I comment out the line "file_regex": "([^\/]+\.java)" the build…
Scorb
  • 1,654
  • 13
  • 70
  • 144
1
vote
1 answer

Set project dependent build system variables

I have written a build system that calls a bash or batch build script. For now I copy and paste the build script in any new project and change the project related properties. To avoid having to modify the script every time (or use only one that…
cmourglia
  • 2,423
  • 1
  • 17
  • 33
1
vote
1 answer

How to make Sublime text build execute on numpad enter?

I use GoSublime inside sublime text for Golang development. Pressing Ctrl + B gives me the build pane, then I need to type a command e.g., go run main.go and press Enter. When I want to execute a command using numpad Enter it doesn't work. How to…
Cute Tom
  • 111
  • 3
  • 9
1
vote
1 answer

Sublime Build variants hotkey

I am running a sublime build system to build my code. I have 4 variants of the build system, and I want to map the first variant to a hotkey. Right now I have the command "Build" mapped to F5. But when I hit it, it says... shell_cmd or cmd is…
Scorb
  • 1,654
  • 13
  • 70
  • 144
1
2 3 4