Tired of typing on the wrong terminal?


Despite having an IDE and graphical tools, I usually have several–maybe too many–terminals while programming in Scala. The bare minimum consists of a tab running SBT and another one with a regular shell to perform the usual git rituals.

The problem with this otherwise lovely scheme is that switching back and forth between tabs, while reasoning about why a test is failing or how to frame the next commit, is error prone. More often than I would like to admit this is the result:

> git status
[error] Expected ID character
[error] Not a valid command: git (similar: exit, plugin, set)
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Not a valid key: git (similar: dist, npt, ivySbt)
[error] git status
[error]    ^
>

This feeling cannot be easily described with words.

One does not simply 'git status' into SBT

Feeling the same? Worry not, because some nice people have created sbt-git a plugin that provides a git command within SBT. In short:

> git status
[info] On branch release-0.8
[info] nothing to commit, working directory clean
>

You can enable it by adding the following line to ~/.sbt/0.13/plugins/plugins.sbt:

addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.8.0")