It seems there are many options in Vim for indenting c code with the cindent and cinoptions variables. I've made no modifications to these settings and I've tested this with a fresh install of Vim and with no vimrc. I can't seem to find an explanation for the following behavior:
If public is used on the first line in the class body, it appears to format the indentation correctly. Using gg=G formats the body like so:
class Thing
{
public:
int a;
};
But, if there's something above it, vim does not indent the line after the public keyword. Using gg=G formats the body like so:
class Thing
{
int b;
public:
int a; //WHY is there no additional indentation level anymore???
};
Does anyone know why this occurs? It's driving me nuts.
Thank you!