|
|
|
|
|
by tmm
1487 days ago
|
|
This is the approach I took when I was teaching myself C in the late '90s. Indent with tabs, align with spaces intuitively made a lot of sense. Then I started using code formatters, initially `indent', then vim plugins. Eventually, I found myself using Visual Studio professionally, and became content letting the IDE decide how code should be formatted. Now, I do whatever the language/community seems to prefer. For .NET stuff, Visual Studio defaults; Go and Rust have their own formatters, RubyMine defaults for Ruby, etc. Everywhere I've worked whenever the code formatting debate comes up, "use the IDE/compiler/community standard" always wins the day. The hardest thing seems to be convincing Windows users that text files need to end with a newline. Is there a git option (like `autocrlf') for that? |
|
It's a lifesaver when you care more about formatting than any of your coworkers and can set up something that handles it for them.
Additionally, configuring editors/IDEs to format code when the file is saved is very useful to enforce formatting rules.
[1]: https://editorconfig.org/