You'll need to create a new build system for Prolog. First, I assume that you already have swipl
installed and it is on your $PATH
. Open Terminal and run the command
which swipl
to find you where it is located, then copy the full path. For example, it may return /usr/local/bin/swipl
. Then, in Sublime, create a new JSON file with the following contents:
{
"cmd": ["/usr/local/bin/swipl", "-f", "$file_name", "-t", "main", "--quiet"],
"working_dir": "$file_path",
"file_regex": "^Warning: (.+):([0-9]+)",
"selector": "source.prolog"
}
substituting "/usr/local/bin/swipl"
for the actual path you copied earlier. Save this in your Packages/User
directory (~/Library/Application Support/Sublime Text 3/Packages/User
) as Prolog_swipl.sublime-build
.
Then, go to Tools -> Build System
and select Prolog_swipl
. You should now be able to build your code using ⌘B. Make sure that your file is saved before building.