Skip to content

Instantly share code, notes, and snippets.

@corbanb
Last active May 2, 2022 22:56
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save corbanb/d0d6bdcfbd8eb455ce99 to your computer and use it in GitHub Desktop.
Save corbanb/d0d6bdcfbd8eb455ce99 to your computer and use it in GitHub Desktop.
Sublime Text - Tools > Build System > New Build System

Build Tools for Sublimetext

  • Add new build systems via Tools > Build System > New Build System.
  • Save files as Language.sublime-build
  • Any commandline tool for compiling code can be used.
  • Cmd + B (OSX) will build files and send output to the Sublime Console

Example Files

Submlime Examples

Sublime Settings

Here you can see where to create new builds and to setup automatic build types. Sublime Build Menu

// Sublime Text - Build System for Javascript
{
"cmd": ["node", "$file"],
"selector": "source.js"
}
// Sublime Text - Build System for PHP
{
"cmd": ["php", "$file"],
"selector": "source.php"
}
@shiju-sr
Copy link

How do we add a python virtual environment

@wzup
Copy link

wzup commented Jun 20, 2018

Doesn't work. SyntaxError: Unexpected token :

/Library/Application Support/Sublime Text 3/Packages/User/nodejs.sublime-build:2
  "cmd": ["/usr/local/bin/node", "$file"],
       ^

SyntaxError: Unexpected token :
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
[Finished in 0.1s with exit code 1]

@IMSoley
Copy link

IMSoley commented Sep 15, 2018

hey @wzup this instructions might help you -

  1. Open your sublime
  2. Open a .js file
  3. Tools > Build System > Select your custom build system (the one you created earlier).
  4. Try again to run your program (CTRL+B - shortcut for windows)

sublime build

@priya1712d
Copy link

'which node' command doesn't work for me. I am using windows 10. I could install node successfully and i can also see the installed version using node --version

@vijayjoyz
Copy link

What is source.js here?

@adeleke5140
Copy link

I'm on Ubuntu 18.04 and I tried the steps here. Unfortunately, nothing is showing in my console
node error

@Saurabh7339
Copy link

hey Folks, i was trying to use javascript for Competitive Programming . i can't find a way to take the input . I came across readline() function but this is not working in sublime-text3 . please help !

@alirezatc
Copy link

Where should we save the file in (macOS)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment