I've been playing a bit with ST2 and it seems like a pretty cute editor. Unfortunatelly, its documentation is horrible.
And I'm being nice. So here's my question.
I have five files in a directory, which I usually build via a .bat file with
ifort file1.f90 file2.f90 file3.f90 ...
how can I define and execute this line on windows cmd (taking account the enviromental variables like PATH) from ST2 via a shortcut and see the output? Is something like that even possible at this stage with ST2?
This worked for me and works with paths and files with whitespaces
.
I have fixed a bug which I've posted on the ST forum here and this here includes that fix.
Paste this into your Batch.sublime-build
file.
This will run cmd.exe and run the code in its native console. This will accept your inputs of the batch file.
{
"file_patterns": ["*.bat", "*.cmd"],
"selector": "source.batch",
// This runs the batch file in the cmd window.
"shell_cmd": "start \"${file_name}\" call \"${file}\""
}
Here's a build that can be saved as BatchStConsole.sublime-build
This will run the code in Sublime Texts' console. This will not accept your inputs of the batch file. But still useful for debugging as it passes any arguments like the native CLI but just no interaction.
{
"file_patterns": ["*.bat", "*.cmd"],
"selector": "source.Batch",
// This outputs to Sublime Texts' console
"shell_cmd": "\"${file}\""
}
Also, in a new file ...\Data\Packages\User\Batch File.sublime-settings
you can then place this code and save. This will build these filetypes when you have automatic build as your build detection.
{ "extensions": [ "bat", "cmd" ] }
Relevant help:
https://ss64.com/nt/start.html
https://docs.sublimetext.io/guide/usage/build-systems.html
https://www.sublimetext.com/docs/3/build_systems.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With