Run scala in Sublime Text 3 with sbt

Make a script sbt-no-color such that the sbt output could show correctly in sublime console.

touch sbt-no-color

And in that file,

#!/bin/bash
export SBT_HOME=/PATH/TO/sbt
java -Dsbt.log.noformat=true -Dfile.encoding=UTF8 $JAVA_OPTS -jar "${SBT_HOME}/bin/sbt-launch.jar" "$@"

Make a new build system in Sublime, naming Scala.sublime-build

{
    "cmd": ["/PATH/TO/sbt-no-color run"],
    "file_regex": "^\\[error\\] ([.a-zA-Z0-9/-]+[.]scala):([0-9]+):",
    "selector": "source.scala",
    "working_dir": "${project_path:${folder}}",
    "shell": "true"
}

Save the build system.

Create a test file with test.scala.

object HelloWorld {
    def main(args: Array[String]) {
        println("Hello, world!")
    }
}

Hit Super + b, done.