Skip to content

Instantly share code, notes, and snippets.

@renanalencar
Last active July 8, 2025 14:32
Show Gist options
  • Save renanalencar/d75e55f1bf4d8fabf0e5e7d12667ebb2 to your computer and use it in GitHub Desktop.
Save renanalencar/d75e55f1bf4d8fabf0e5e7d12667ebb2 to your computer and use it in GitHub Desktop.
.editorconfig for Kotlin projects using ktlint
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
[*.{kt,kts}]
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
ij_kotlin_continuation_indent_size = 4
# Comments
ij_kotlin_line_comment_at_first_column = false
ij_kotlin_line_comment_add_space = true
ij_kotlin_line_comment_add_space_on_reformat = true
# Imports
ij_kotlin_name_count_to_use_star_import = 2147483647
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
ij_kotlin_packages_to_use_import_on_demand = unset
ij_kotlin_import_nested_classes = false
ij_kotlin_imports_layout = *,^ # avoid grouping imports per package
# Linebreak and whitespaces
ij_kotlin_keep_blank_lines_in_declarations = 1
ij_kotlin_keep_blank_lines_in_code = 1
ij_kotlin_keep_blank_lines_before_right_brace = 0
# Expression and style
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
# Alignment (Jetpack Compose recommends avoiding complex alingments)
ij_kotlin_align_multiline_parameters = false
ij_kotlin_align_multiline_parameters_in_calls = false
ij_kotlin_align_multiline_method_parentheses = false
ij_kotlin_align_multiline_binary_operation = false
# Jetpack Compose
ij_kotlin_use_custom_formatting_for_modifiers = true
[*.xml]
indent_size = 4
ij_xml_keep_line_breaks = false
ij_xml_align_attributes = false
ij_xml_space_around_equals_in_attribute = false
ij_xml_space_after_tag_name = false
ij_xml_use_custom_settings = true
[*.{yml,yaml}]
indent_size = 2
[*.md]
trim_trailing_whitespace = false
ij_markdown_wrap_text_if_long = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment