forked from Binocular222/Sublime-Text-3-Full-Documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.txt
53 lines (51 loc) · 10 KB
/
Build.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
:Build:
Open current file with external programs
Running Build Systems: Tools | Build (F7)
Each package can define its own build systems
.sublime-build:
{
"cmd": ["python.exe", "-u", "$file"], //Actual command line to be executed i.e: python -u /path/to/current/file.ext
"file_regex": //Optional: Perl-style Regex to capture error info from external program’s output. It Capture 4 info: filename, line number, column number, error message. filename field and the line number field are required.
"line_regex": //Optional: If the file_regex doesn’t match on the current line, but there’s a line_regex specified, and it does match the current line, then walk backwards through the buffer until a line matching the file regex is found: use these two matches to determine the file and line to go to.
"working_dir": //Optional: Temporarily change the current directory before running cmd
"encoding": //Optional: Output encoding of cmd. Must be a valid Python encoding. Defaults to UTF-8.
"target": //Optional: Sublime Text command to run. Defaults to exec (Packages/Default/exec.py). This command receives the configuration data specified in the .build-system file. Used to override the default build system command. Note that if you choose to override the default command for build systems, you can add arbitrary variables in the .sublime-build file.
"env": //Optional: Dictionary of environment variables to be merged with the current process’ before passing them to cmd. Use this element, for example, to add or modify environment variables without modifying your system’s settings.
"shell": //Optional: If true, cmd will be run through the shell (cmd.exe, bash...).
"variants": //Optional: A list of dictionaries of options to override the main build system’s options. Variant ``name``s will appear in the Command Palette for easy access if the build system’s selector matches for the active file.
"name": //Optional: Only valid inside a variant (see variants). Identifies variant build systems. If name is Run, the variant will show up under the Tools | Build System menu and be bound to Ctrl + Shift + B.
"syntax": //Optional: When provided, the build system output will be formatted with the provided syntax definition.
"selector": "source.python" //Optional: If enable Tools | Build System | Automatic → ST auto find proper build system for active file
"path": //Optional: Path to external prog if its short name (python.exe) is not register in the OS
"windows": {"cmd": ... }, //Optional: Specific build for each OS
"osx": {"cmd": ... },
"linux": {"cmd": ... }
}
"cmd": ["path-to-external-prog", "output option", "argument"]
quotes must be escaped by \" , i.e: "shell_cmd": "python -u \"$file\""
output option
actual switch depend on external-prog i.e, Python's output switch:
"-l" = lint (output error message only)
"-u" = Output final result
To show Output result (i.e: error messages)
Preferences > settings: "show_panel_on_build": true,
Or having KB shortcut:
{ "keys": ["f12"], "command": "show_panel", "args": {"panel": "output.exec"} },
{"keys": ["f8"], "command": "show_panel", "args": {"panel": "output.exec", "toggle": true} }
argument
is the command-line parameter passed to external prog.
Variables can be:
| $file_path | The directory of the current file, e.g., C:\Files |
| $file | The full path to the current file, e.g., C:\Files\Chapter1.txt |
| $file_name | The name portion of the current file, e.g., Chapter1.txt |
| $file_extension | The extension portion of the current file, e.g., txt |
| $file_base_name | The name-only portion of the current file, e.g., Document |
| $packages | The full path to the Packages folder |
| $project | The full path to the current project file |
| $project_path | The directory of the current project file |
| $project_name | The name portion of the current project file |
| $project_extension | The extension portion of the current project file |
| $project_base_name | The name-only portion of the current project file |
Can use Placeholders (similar to snippets), i.e:
${project_name:Default} = Emit the name of the current project if there is one, otherwise Default.
${file/\.php/\.txt/} = Emit the full path of the current file, replacing .php with .txt.