[Libreoffice] Preferred indentation for LibreOffice
tlillqvist at novell.com
Mon Nov 15 00:15:24 PST 2010
> /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
> This will be the preferred style for LibreOffice project?
Those settings are not by themselves enough to describe the traditional OOo, and thus also LibreOffice, coding style, but they do express (I believe; I am not a vim user) the ground rules: four column indentation "steps" or "offset", and no TABs in source files.
Using an appropriate number of spaces instead of actual TAB characters in the source files is very much preferred, and using spaces for indentation is actually enforced by our git hooks. And, if/when TAB characters still appear in source files, they should be interpreted as tabulating to the next multiple of four columns.
(Note: saying "TABs expand to four spaces" is over-simplifying and incorrect (although presumably people who say that don't actually mean it literally); the number of spaces (or other characters, for that matter) needed to reach the next multiple of four columns obviously depends on the column you are at. And obviously, all talk about "columns" assume a typewriter-style fixed-width typeface is used.)
Details concerning the preferred use of white space around parentheses in function calls etc, placement of braces, etc, can be learned by looking at existing source files. For Emacs users, there is also elisp code available in the OOo wiki, I think it was, to set up an Emacs hook for proper handling of OOo/LO source files.
More information about the LibreOffice