Currently, vim aligns my public:
s like so:
class foo {
public:
void bar();
}
Which is to say, 2 spaces before public:
and then a full tab (which is three spaces in my case) after it.
How would I get it to align thus:
class foo {
public:
void bar();
}
As in the void bar();
is indented at exactly one tab (three spaces), and the public:
is sort of "halfway" (or one spaces in)?
C++ indention defaults to cindent
and as such can be tweaked by setting cinoptions
. To get the indention you ask for, do this:
set cinoptions+=g1,h2
See :help cino-g
and :help cino-h
.
As mentioned in the comments cino-g
and h
do not always work, an alternative is :help cinoptions-values
which leads to the same list. :help indent.txt
is also useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With