I had been using auto indentation from VIM, which a bit of my style, which I very compact, but not necessarily readable. A better solution is to use some standard and well thought style, which is familiar to others. For newly created code, we can agree that we will use LLVM format style. LLVM is one the most popular formatting styles, and can be used easily set up in atom, VS code and many other editors. Editors using clang-fromat by packages or extensions.
How to set-up VS-code:
Install the clang-format extension and set LLVM style by adding line to users configuration,
"C_Cpp.clang_format_fallbackStyle": "LLVM"
To format code Shift + Option +F on mac, on Ctr + Chift +I on Ubuntu and Shift + Alt + F on Windows. I using VIM keyboard map, and use "=" key to format code.
How to set-up Atom.io:
Install clang-format package. To format code, you press Shift-Cmd + K.
If you using VIM key-map, you can add your clang-format kay map, i.e.
'atom-text-editor':
'=': 'clang-format:format'
From now on we could agree that only clang-formatted code with LLVM style is accepted in pull requests.
Kind regards,
Lukasz