.editorconfig 生成器

生成 .editorconfig 文件,配置缩进风格、缩进大小、行尾符、字符集及文件类型覆盖规则。

预设

全局配置 [*]

文件类型规则

[]
[]

输出

What Is an .editorconfig Generator?

An .editorconfig generator creates a ready-to-use .editorconfig file based on your project's coding conventions. The EditorConfig format is supported natively by VS Code, JetBrains IDEs, Vim, Neovim, Emacs, and many other editors — no plugin needed for most. This tool lets you configure indent style, indent size, end-of-line, charset, trailing whitespace, and final newline settings, then add per-file-type overrides for files like Makefile, *.go, or *.py. Quick presets for Go, Python, and Java are included.

How to Use the .editorconfig Generator

  1. Choose a preset to start from (Default, Go, Python, or Java), or configure from scratch.
  2. Set the global indent style, indent size, end-of-line character, and charset that apply to all files.
  3. Toggle trim trailing whitespace and insert final newline as needed.
  4. Add file-specific rules for overrides (e.g., 4-space indent for *.py, tab indent for Makefile).
  5. Click Download to save as .editorconfig, or Copy to copy to clipboard.

Features

  • Global [*] section: indent style, indent size, end-of-line, charset
  • Per-file-type override rules with custom glob patterns
  • Quick presets: Default, Go, Python, Java
  • Trim trailing whitespace and insert final newline toggles
  • Real-time preview — updates as you change options
  • One-click download as .editorconfig
  • Copy to clipboard

FAQ

What is .editorconfig?

EditorConfig is a file format and editor plugin system that helps developers maintain consistent coding styles across different editors and IDEs. A .editorconfig file defines rules like indent style, indent size, end-of-line character, and charset. Most modern editors support it natively or via a plugin.

Does EditorConfig replace Prettier or ESLint?

No. EditorConfig handles low-level whitespace and encoding settings that editors apply while you type. Prettier enforces formatting on save or commit. ESLint checks code quality and style rules. They complement each other — use EditorConfig for editor-level defaults, Prettier for code formatting, and ESLint for linting.

What does root = true mean?

When root = true is set, EditorConfig stops looking for .editorconfig files in parent directories. Place this at the top of your root .editorconfig file so that editor settings are self-contained within your project and not accidentally inherited from a parent directory.

Can I have different indent settings for different file types?

Yes. EditorConfig supports section headers like [*.py] or [Makefile] to apply settings only to matching files. For example, Go typically uses tabs while JSON uses 2-space indentation. File-specific rules override the [*] global defaults for matching files.