Argument | Example | Notes |
---|---|---|
cmd |
['python', '-m', '$project'] |
Required if shell_cmd is empty; overridden by shell_cmd ; searched in PATH |
shell_cmd |
yarn build |
Required if cmd is empty; overrides cmd |
working_dir |
?? | Temporarily change to directory before executing cmd |
env |
{ EDITOR: 'vim' } ? |
Can merge in a dictionary before passing to cmd ; expands environment variables. |
shell |
true |
Runs cmd through the shell if true ; noop if shell_cmd is used |
path |
/User/sarah/git |
Used by cmd ; expands environment variables. |
Expanded in cmd
, shell_cmd
, and working_dir
.
Variable | Example | Description |
---|---|---|
$file_path |
/User/sarah/git/dtr/chrome-remote-css |
Full path to directory of current file |
$file |
/User/sarah/git/dtr/chrome-remote-css/src/main.js |
Full path to current file |
$file_name |
main.js |
Name of current file |
$file_extension |
js |
Extension of current file |
$file_base_name |
main |
Name of current file, without extension |
$folder |
?? | Path to the first folder opened in current project |
$project_path |
/User/sarah/git/dtr |
Full path to directory current .sublime-project file |
$project_name |
chrome-remote-css |
Name of current .sublime-project file |
${project_name:Default}
Name of the current project if there is one, otherwise Default
.
${file/\.php/\.txt/}
Full path of the current file, replacing .php
with .txt
.
Replace ANSI escape codes with nice colors using SublimeANSI and adding the following to your build system:
{
"name": "Nicely colored build system", // obviously change this to whatever
// ...
"target": "ansi_color_build",
"syntax": "Packages/ANSIescape/ANSI.tmLanguage"
}
For situations where $project_path
doesn't cut it, use
git rev-parse --show-toplevel
to get to the root of the current git repository. So:
{
// ...
"shell_cmd": "cd `git rev-parse --show-toplevel` && <YOUR BUILD COMMAND HERE>"
}