Red Hat Bugzilla – Bug 837637
vim cannot indent C files
Last modified: 2012-08-28 10:15:50 EDT
When editing a C file in vim it is not possible to use vim autoindentation.
vim calls external indent program to perform the function.
1) indent is not a dependency of vim
2) it cannot be used on code snippets (as vim tries to), probably requires whole files
seems to be the case in compatible mode only
that's intentional and documented in the vim help (:h compatible). compatible mode disables cindent and that's what does most of the autoindent stuff. Without cindent you'll get only the same indents that the last line had, but no automatic indentation of braces and such.
btw: vim has its own indent implementation and doesn't need an external indent program. You can still use it with p.e. :'<,'>!indent (after you've marked a range with 'V')
The problem here is that indentation commands (=) call non-existent binary and instead of indenting remove text. I don't see how that is derived from the description of compatible mode.
The description of = says that internal indentation is used when compiled in. I don't see where it says that in compatible mode it will pretend this is not compiled in and instead of formatting text filter it through non-existent command and remove it as a consequence.