Skip to content

Instantly share code, notes, and snippets.

@Krisztiaan
Created February 26, 2025 12:22
Show Gist options
  • Save Krisztiaan/8f01af2c98fe9f26da21cecbe558020c to your computer and use it in GitHub Desktop.
Save Krisztiaan/8f01af2c98fe9f26da21cecbe558020c to your computer and use it in GitHub Desktop.
Editor config for C, ESP-IDF dev
# Top-most EditorConfig file
root = true
# Common settings for all files
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
# C/C++ specific settings
[*.{c,h,cpp,hpp}]
indent_size = 4
max_line_length = 100
# The following are typically enforced by a formatter like clang-format
# but editorconfig hints at the style
curly_bracket_next_line = true
indent_brace_style = Allman
spaces_around_operators = true
spaces_around_brackets = inside
# Header guard style
# Use #ifndef FOO_H / #define FOO_H / #endif pattern
# CMake files
[CMakeLists.txt]
indent_size = 4
# Component configuration files
[Kconfig*]
indent_size = 4
# Makefile needs tabs
[Makefile]
indent_style = tab
# YAML files (for ESP-IDF configurations)
[*.{yml,yaml}]
indent_size = 2
# JSON files
[*.json]
indent_size = 2
# Shell scripts
[*.sh]
indent_size = 2
shell_variant = bash
binary_next_line = true
switch_case_indent = true
space_redirects = true
# Documentation
[*.md]
trim_trailing_whitespace = false
# ESP-IDF specific project config
[sdkconfig]
indent_size = 4
# JetBrains IDE files
[.idea/**/*.xml]
indent_size = 2
# VSCode settings files
[.vscode/*.json]
indent_size = 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment