EditorConfig 
EditorConfig helps developers maintaining consistent coding styles between different editors.
"I will take a peanut butter sandwich on white bread" -- Ralph S. Mouse
Install
$ apm install editorconfig
Or, Settings β Install β Search for editorconfig
Getting started
See the EditorConfig documentation for detailed description of the .editorconfig-file format.
- Open a project which contains an
.editorconfig-file. - Whenever you open a file in the project (or change any
.editorconfig-file from within Atom), EditorConfig evaluates the editorconfig-settings for the current file. - EditorConfig then applies these settings to your current editor-pane. Any change you're doing from now on will be according to the editorconfig provided.
- You can always prove the currently applied settings by invoking the
EditorConfig: Show State-command. You might try to fix malformed files withEditorConfig: Fix File.
π‘ If EditorConfig can detects any troubles which may prevent it from working properly aπ will be shown in the status bar, click on it to open the state-notification.
β οΈ EditorConfig will not fix malformed files (f.e. change all soft-tabs to hard-tabs) this must be done by explicitly invoking f.e.EditorConfig: Fix File. Keep in mind that malformed files (especially mixed tab-characters) may lead to unexpected behaviour.
Supported properties
rootindent_styleindent_size/tab_width(indent_sizetakes precedence overtab_width)charset(supported values:latin1,utf-8,utf-16be,utf-16le)end_of_line(supported values:lf,crlf)trim_trailing_whitespace(supported values:true,false)insert_final_newline(supported values:true,false; Setting this tofalsestrips final newlines)max_line_length
π‘ Any malformed or missing property is set toautowhich leaves the control to Atom.
Provided commands
EditorConfig: Fix File: Fixesindent_styleandend_of_line-issues for the current editor.EditorConfig: Show State: Shows the current state of EditorConfig for your current editor.EditorConfig: Generate Config: Generates an initial.editorconfigfor your project.
Features
- Applies the settings from your
.editorconfigfile - Ability to fix
indent_styleandend_of_line-issues - Syntax highlights
.editorconfigfiles (now with specification-like case insensitivity) - Ability to generate an
.editorconfigfile based on the current settings - Displays a nifty
π in the statusBar whose colorful shows you if editorconfig faces any problems - Clicking on the
π invokes theShow State-command for you - Recognizes if you save any
.editorconfig-file and reapplies all settings to all opened editor-panes
Example file
root = true
[*]
indent_style = tab
indent_size = 3
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{json,yml}]
indent_size = 2
[*.md]
trim_trailing_whitespace = falseChangelog
- 2.0: We finally support all editorconfig-properties (with the lately added
max_line_length); introducingEditorConfig: Fix File; fixing editorconig's onSave handling - 1.7: Showing the StatusBar-icon only on troubles; introducing
EditorConfig: Show State; optimizing grammar
Troubleshooting
We're sorry to hear you have troubles using atom-editorconfig! However, we are aware of some caveats:
- Why isn't editorconfig applying the indentation character to my files? Editorconfig is not intended to do so, it will apply the indentation-char only to new indentations. However, you may try to fix indentation-issues with the
EditorConfig: Fix File-command. - Why is the
indent_stylecompletely not working? Your Atom's config setting "Tab Type" might be set either tosoftorhard, this unfortunately prevents editorconfig from influencing the indentation style. Set Atom's "Tab Type" toautoto fix that. - Why is the feature X not working? Sometimes other packages (f.e. like the "whitespace"-package) override the editorconfig-settings. You might try to fix this by deactivating the package in your settings. We try to "warn" you about confirmed interferences caused by other packages. If you face any unknown troubles, please give us a hint.
π‘ You can check how editorconfig affects your current file by invoking theEditorConfig: Show State-command. If EditorConfig can detects any troubles which may prevent it from working properly aπ will be shown in the status bar, clicking on it also lets you open the state-notification.
Help us getting better
We would be happy to hear from you -- please report us any feedback, issues or ideas. Thank you!
License
MIT Β© Sindre Sorhus
