开发者

Avoiding label indenting in C++

I guess this was asked before, but I could not find any similar question.

When writing part of the scope operator in C++, Vim guesses that it's going to be a label (on the first :) and then indents it automatically, which is pretty annoying. Example:

#1 - initial typing

{
    std

#2 - added :

{
std:

#3 - added :

{
    std::

Of course, it's correct at the end, but is there any way to disable the automatic indent for labels? I rarely use them, and it wouldn't be a great deal to indent manually in those cas开发者_如何学Goes.


Just tell vim not to de-indent labels with:

:set cinoptions+=L0

For reference, if by "visibility" modifiers you mean access specifiers, these can be set to not indent with:

:set cinoptions+=g0
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜