lucyfmt

A minimal code formatter for Odin

A minimal formatter for Odin. It only fixes indentation and leaves everything else as you wrote it.

Features

  • Indents lines with 1 tab per scope level
  • Enforces proc() { (Opening brace on the same line as the signature)
  • Does not indent when blocks
  • Leaves the contents like multi line strings and multi line comments untouched
  • Adds one indent level to parameters if they were broken up into multiple lines.

Example

Input:

main :: proc() 
{

	/*
hello
   odd multi line comment here
      spaces and tabs
*/

	when ODIN_DEBUG 
	{
		fmt.println(
"hello",
"world"
		)
	}
}

Output:

main :: proc() {

	/*
hello
   odd multi line comment here
      spaces and tabs
*/

	when ODIN_DEBUG {
	fmt.println(
		"hello",
		"world"
	)
	}
}

Build

odin build .

Usage

./lucyfmt file.odin          # print to stdout
./lucyfmt -w file.odin       # format in-place
cat file.odin | ./lucyfmt    # read from stdin