Avoiding label indenting in C++

[亡魂溺海] 提交于 2019-11-30 00:48:21

问题


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 cases.


回答1:


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


来源:https://stackoverflow.com/questions/6471556/avoiding-label-indenting-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!