Vim: alignment of an open keyword

Currently vim aligns my public: like this:

 class foo { public: void bar(); } 

Let's say 2 spaces before public: and then after it the full tab (these are three spaces in my case).

How can I make it align like this:

 class foo { public: void bar(); } 

As in void bar(); indented on one tab (three spaces), and public: is it kind of "half" (or one space)?

+4
source share
1 answer

The default C ++ indent value is cindent and as such can be changed by setting cinoptions . To receive a request, you ask:

 set cinoptions+=g1,h2 

See :help cino-g and :help cino-h .

As cino-g and h mentioned in the comments, they do not always work, the alternative is :help cinoptions-values , which leads to the same list. :help indent.txt also useful.

+10
source

Source: https://habr.com/ru/post/1433362/


All Articles