This document describes the public formatter configuration groups and the intended effect of each option.
luafmt and the library path-aware helpers support nearest-config discovery for:
.luafmt.tomlluafmt.toml
Supported explicit config formats are:
- TOML
- JSON
- YAML
kind:SpaceorTabwidth: logical indent width
Default:
[indent]
kind = "Space"
width = 4max_line_width: preferred print widthmax_blank_lines: maximum consecutive blank lines retainedtable_expand:Never,Always, orAutocall_args_expand:Never,Always, orAutofunc_params_expand:Never,Always, orAuto
Default:
[layout]
max_line_width = 120
max_blank_lines = 1
table_expand = "Auto"
call_args_expand = "Auto"
func_params_expand = "Auto"Behavior notes:
Autolets the formatter compare flat and broken candidates.- Sequence-like structures can now choose between fill, packed, aligned, and one-per-line layouts when applicable.
- Binary-expression chains and statement expression lists may prefer a balanced packed layout when it keeps the same line count but avoids ragged trailing lines.
insert_final_newlinetrailing_comma:Never,Multiline, orAlwaystrailing_table_separator:Inherit,Never,Multiline, orAlwaysquote_style:Preserve,Double, orSinglesingle_arg_call_parens:Preserve,Always, orOmitsimple_lambda_single_line:Preserve,Always, orNeverend_of_line:LForCRLF
Default:
[output]
insert_final_newline = true
trailing_comma = "Never"
trailing_table_separator = "Inherit"
quote_style = "Preserve"
single_arg_call_parens = "Preserve"
simple_lambda_single_line = "Preserve"
end_of_line = "LF"Behavior notes:
trailing_commais the general trailing-comma policy for sequence-like constructs.trailing_table_separatoroverrides that policy for tables only.Inheritkeeps usingtrailing_comma.quote_styleonly rewrites normal short strings when it is safe to do so. Long strings and other string forms are preserved.- Quote rewriting works from the raw token text, checks for unescaped occurrences of the target delimiter, and only adjusts the minimal delimiter escaping needed to preserve semantics.
single_arg_call_parens = "Omit"only removes parentheses for Lua-valid single-string and single-table calls.simple_lambda_single_line = "Preserve"only keeps an eligible simple lambda on one line when the input was already inline.simple_lambda_single_line = "Always"collapses an eligible simple lambda back tofunction(...) return expr endwhen it fits within the configured width.simple_lambda_single_line = "Never"disables the simple inline lambda fast path and always formats the closure body on multiple lines.
space_before_call_parenspace_before_func_parenspace_inside_bracesspace_inside_parensspace_inside_bracketsspace_around_math_operatorspace_around_concat_operatorspace_around_assign_operator
These options control token spacing only. They do not override larger layout decisions such as whether an expression list should break.
align_line_commentsalign_in_statementsalign_in_table_fieldsalign_in_call_argsalign_in_paramsalign_across_standalone_commentsalign_same_kind_onlyspace_after_comment_dashline_comment_min_spaces_beforeline_comment_min_column
Default:
[comments]
align_line_comments = true
align_in_statements = false
align_in_table_fields = true
align_in_call_args = true
align_in_params = true
align_across_standalone_comments = false
align_same_kind_only = false
space_after_comment_dash = true
line_comment_min_spaces_before = 1
line_comment_min_column = 0Behavior notes:
- Statement comment alignment is disabled by default.
- Table, call-arg, and parameter trailing-comment alignment are input-driven. Extra spacing in the original source is treated as alignment intent.
- Standalone comments usually break alignment groups.
- Table-field trailing-comment alignment is scoped to contiguous subgroups rather than the whole table.
space_after_comment_dashonly inserts one space for plain comments such as--commentwhen there is no gap after the prefix already; comments with larger existing gaps are preserved.
align_tag_columnsalign_declaration_tagsalign_reference_tagstag_spacingspace_after_description_dash
Default:
[emmy_doc]
align_tag_columns = true
align_declaration_tags = true
align_reference_tags = true
tag_spacing = 1
space_after_description_dash = trueStructured handling currently covers @param, @field, @return, @class, @alias, @type, @generic, and @overload.
continuous_assign_statementtable_field
Default:
[align]
continuous_assign_statement = false
table_field = trueBehavior notes:
- Continuous assignment alignment is disabled by default.
- Table-field alignment is enabled, but only activates when the source already shows extra post-
=spacing that indicates alignment intent.
[layout]
max_line_width = 100
table_expand = "Auto"
call_args_expand = "Auto"
func_params_expand = "Auto"
[comments]
align_in_statements = false
align_in_table_fields = true
align_in_call_args = true
align_in_params = true
[align]
continuous_assign_statement = false
table_field = true[indent]
kind = "Space"
width = 4
[layout]
max_line_width = 120
max_blank_lines = 1
table_expand = "Auto"
call_args_expand = "Auto"
func_params_expand = "Auto"
[output]
insert_final_newline = true
trailing_comma = "Never"
trailing_table_separator = "Inherit"
quote_style = "Preserve"
single_arg_call_parens = "Preserve"
simple_lambda_single_line = "Preserve"
end_of_line = "LF"
[spacing]
space_before_call_paren = false
space_before_func_paren = false
space_inside_braces = true
space_inside_parens = false
space_inside_brackets = false
space_around_math_operator = true
space_around_concat_operator = true
space_around_assign_operator = true
[comments]
align_line_comments = true
align_in_statements = false
align_in_table_fields = true
align_in_call_args = true
align_in_params = true
align_across_standalone_comments = false
align_same_kind_only = false
space_after_comment_dash = true
line_comment_min_spaces_before = 1
line_comment_min_column = 0
[emmy_doc]
align_tag_columns = true
align_declaration_tags = true
align_reference_tags = true
tag_spacing = 1
space_after_description_dash = true
[align]
continuous_assign_statement = false
table_field = true