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
1
vote
1 answer

Sublime text build system, using ~ and /home/username directories

I have my own build system for perl test files, and it works just fine except when capturing input. If I have an open file called, e.g., ~/projects/something.pm, on error the output of the build system will be something like Failed test at…
ChatterOne
  • 3,381
  • 1
  • 18
  • 24
1
vote
1 answer

Run pascal in Sublime Text in OS X

I want to run pascal code in Sublime Text (Sublime Text 2) in OS X Mavericks. I find this sublime-build that work and run in windows. (Created by Qwerty. https://stackoverflow.com/users/985454/qwerty) { "cmd": ["fpc",…
Txutxi
  • 11
  • 2
0
votes
1 answer

Adding subcommand within Sublimetext custom build

In Sublimetext editor, we can specify custom build command using shell_cmd exec Target Options. I want to add a subcommand within shell_cmd value. For Linux terminal commands, this can be done as outer-bin arg1 $(inner-command), where…
0
votes
1 answer

Auto run .exe file after building c++ using sublime text 3

I found this build configuration online: { "cmd": ["C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/g++", "-o", "${file_path}/${file_base_name}.exe", "-static-libgcc", "-static-libstdc++", "${file_path}/${file_base_name}.cpp"], "file_regex":…
dummycode
  • 80
  • 5
0
votes
1 answer

How to exit PowerShell on a keypress, after the program has been executed?

I am trying to build a custom sublime-build that executes c++ programs in powershell. I want powershell to exit itself on pressing enter or any other key. How can this be done ? This is my sublime-build so far.. { "cmd": ["g++", "${file}",…
0
votes
1 answer

Sublime Text 3 intel oneAPI Fortran build system

Has anyone figured out how to write the build system for the oneAPI Fortran compiler? Previously, i was using Parallel Studio XE ifort, and i managed to get it working using the solution here: { "cmd": ["cmd", "/e:on", "/v:on", "/k",…
0
votes
1 answer

Sublime Text 3 with "Make" build system doesn't run the program

I am trying to build a C++ project in Sublime Text 3 on Linux. Normally I just swap to the terminal and run make run and it runs. However, I'm trying to streamline the process by running directly in Sublime. However, pressing Ctrl+Shift+B brings up…
0
votes
1 answer

Trying to port windows build system to linux

This build system is for competitive coding in c++ on sublime text in 3 column view { "cmd": ["g++.exe","-std=c++17", "${file}", "-o", "${file_base_name}.exe", "&&" ,…
0
votes
0 answers

MySQL on Sublime text 3 on MAcOS

I'm writing this command "cmd": ["/usr/local/mysql/bin/mysql", "-u", "root", "-e", "source $file", "-t"], "selector": "source.sql" on Sublime Text 3 to create a new build system for MySQL on my MAcOS Catalina . But it shows the error:: ERROR…
0
votes
0 answers

How to fix encoding issues for Sublime Text?

I am creating a custom build system. The third-party app returns result text with the following symbols: \xd0\x9a\xd0\xb0\xd0\xb6\xd0\xb5\xd1\x82\xd1\x81\xd1\x8f \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439 \u00a0\u00a0 Is there…
LA_
  • 19,823
  • 58
  • 172
  • 308
0
votes
1 answer
0
votes
1 answer

How to execute sub-shell commands in Sublime Text 3 build systems?

I am trying to write a generic build system for my C++ projects on a remote machine. The remote home directory ~/ is mounted on my local machine at /network/mountdir/ and my file_path=/network/mountdir/project_dir/file.cc corresponds to…
Nanashi No Gombe
  • 510
  • 1
  • 6
  • 19
0
votes
0 answers

Sublime link command error when run python?

I am having link command error with sublime when I am trying to run python scripts. It used to work fine. ld: warning: ignoring file /Users/Documents/sideproj/IoT/one_hot_encoding.py, file was built for unsupported file format ( 0x0A 0x69 0x6D 0x70…
Erin
  • 83
  • 1
  • 9
0
votes
2 answers

Modify existing build system in sublime text 3

I am currently using the below build system in ST3 for compiling .cpp codes { "cmd": ["mingw32-g++.exe", "-c", "$file", "-o", "${file_path}/${file_base_name}.o", "&&", "mingw32-g++.exe", "-o", "${file_path}/${file_base_name}.exe",…
kalpaj agrawalla
  • 878
  • 1
  • 9
  • 19
0
votes
1 answer

SublimeText3 is Building in Python 2 but I want to use Python 3. How do I Change Versions (Ubuntu 18.04)?

I'm trying to get SublimeText3 to build with Python 3 on Ubuntu 18.04. I have python 3.6.6 installed on my Ubuntu machine, but Sublime is defaulting to Python 2 when I press ctrl+b. When I search with the "build with" option, no Python 3 option is…
Craig
  • 55
  • 7