I love code. I take care of my code and I like my code to be formatted nicely. No matter if I’m on Eclipse, Netbeans or IntelliJ, I want my code to be formatted the same.
Nowadays we have EditorConfig. In the source code we can place a file
.editorconfig with formatting instructions. These instructions can be read by many Tools like Eclipse, Netbeans, IntelliJ and VisualStudio. If we create an
.editorconfig file with formatting instructions, these rules are automatically applied.
An example of an
.editorconfig file looks like:
root = true
indent_style = space
indent_size = 2
continuation_indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_size = 4
continuation_indent_size = 4
As you see you can define specific formatting rules for different file types.
Happy coding and formatting!