How to avoid namespace content indentation in vim?

前端 未结 5 665
慢半拍i
慢半拍i 2020-12-24 11:57

How to set vim to not indent namespace content in C++?

namespace < identifier >
{
    < statement_list > // Unwanted indentation
}
5条回答
  •  遥遥无期
    2020-12-24 12:53

    Not sure when it was introduced but my installed version of vim, v7.3.353 has a cino option that handles cpp namespace explicitly. I am currently using the example value:

    cino=N-s

    and as per :help cinoptions-values

    NN    Indent inside C++ namespace N characters extra compared to a
      normal block.  (default 0).
    
    cino=                      cino=N-s 
      namespace {                namespace {
          void function();       void function();
      }                          }
    
      namespace my               namespace my
      {                          {
          void function();       void function();
      }                          }
    

    The link the OP posted is for v7.3.162

提交回复
热议问题