Kotlin Formatting (ktfmt)

Elide comes with a built-in Kotlin formatter. It is ktfmt, but with native image technology it starts up faster and saves time, especially with smaller projects You can use it via elide ktfmt -- .... It is fully compatible and drop-in ready.

Note

There are no Elide-specific options before -- at this time. The -- separator is still required.

Examples

Fix an incorrectly formatted Kotlin file:

kotlin
// Hello.kt
fun   main()
{
      println("Hello!");
}
bash
 elide ktfmt -- -replace Hello.kt && cat Hello.kt
terminaloutput
Done formatting ./Hello.kt
fun main() {
  println("Hello!")
}