Answer the question
In order to leave comments, you need to log in
Sublime Text 3, auto select Build System?
Sublime has an automatic build system selection, but it only works for pre-installed Build Systems.
I have two of my own Build Systems, but they do not automatically switch for files, and I cannot edit the standard ones, because can't find configuration files.
How to comfortably run python code in one tab and C++ code in another tab? Without manually switching Build System every time.
Answer the question
In order to leave comments, you need to log in
You can set hotkeys for those builds (hereinafter also "builds", etc.) that you use.
When it was already necessary to enter hotkeys into this file with JSON syntax, [square brackets] should be placed only at the beginning and end, but not between commands separated by commas. File example:
[
// Clickable URL — открыть URL, на которую наведён курсор
{ "keys": ["alt+enter"], "command": "open_url_under_cursor" },
// Открыть PowerShell
{ "keys": ["ctrl+7, ctrl+t"], "command": "open_terminal" },
// Наш Build
{ "keys": ["ctrl+alt+b"], "command": "build", "args": {"build_system": "Packages/User/SashaIsMyIdol.sublime-build", "variant": "" }
]
keys
— an arbitrary but unoccupied shortcut, build_system
— the path to your build file with the extension .sublime-build
, starting from the folder Packages
. Ctrl+Alt+B
, → build should start. Key Bindings - User
. We also need to find out where the build files are located. Ctrl+Shift+P
→ PackageResourceViewer: Open Resource
(thanks to fuzzy-search it is enough to enter prv
) → Ruby
→ Ruby.sublime-build
. In the title of the page, we look at the path to the build file, and enter it:Packages/Python/Python.sublime-build
, plus Packages/C++/C++ Single File.sublime-build
. source.python meta.function.python entity.name.function.python
, it will be necessary to substitute only source.python
. Python build example:{
"cmd": ["python", "-u", "$file"],
"file_regex": "^[ ]*File
quot;(...*?)
quot;, line ([0-9]*)",
"selector": "source.python"
}
{
"cmd": ["g++", "$file", "-o", "$file_base_name", "-I/usr/local/include"],
"selector": "source.c++",
"windows": {
"cmd": ["cl", "/Fo${file_path}", "/O2", "$file"]
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question