ledgerfmt

Configuration

Settings live in ledgerfmt.toml, discovered upward from the file being formatted.

Example

[format]
amount_column = 52
indent = 4
currency_position = "suffix"
align_comments = true

[files]
extensions = ["journal", "ledger"]

[format]

KeyTypeDefaultDescription
amount_columninteger50Column that amounts are right-aligned to. Postings longer than this keep a single separating space.
indentinteger4Spaces before each posting line. Tabs are always expanded.
currency_positionstring"suffix"Either "prefix" or "suffix". Mixed input is normalised to one form.
align_commentsbooltrueAlign trailing ; comments within a transaction.
blank_linesinteger1Blank lines kept between transactions.

[files]

KeyTypeDefaultDescription
extensionslist["journal"]Extensions picked up when walking a directory.
follow_includesboolfalseAlso format files pulled in by include directives.

Precedence

Command-line flags override the config file, which overrides the defaults. Use --print-config to see the settings actually in effect:

$ ledgerfmt --print-config accounts.journal
amount_column = 52   (ledgerfmt.toml)
indent        = 4    (default)
A malformed ledgerfmt.toml is a hard error. ledgerfmt will not silently fall back to defaults, because that would change the formatting of every file.