C++ 如何在linux中使用'indent'实用程序更正命名空间块中的缩进

C++ 如何在linux中使用'indent'实用程序更正命名空间块中的缩进,c++,linux,indentation,C++,Linux,Indentation,(我已将此问题发布在并标出了主题。主持人建议将问题发布在SO) 我正在使用indent来更正缩进。除了名称空间块中的缩进之外,一切都正常 我有示例代码: $ cat test2.cc #include <iostream> namespace API { void f () { std::cout << "f() called" << std::endl; } } 我不想第一次缩进名称空间块,也不想很难找到任何相关的缩进选项(这非常复杂)。我怎么才

(我已将此问题发布在并标出了主题。主持人建议将问题发布在SO)

我正在使用
indent
来更正缩进。除了名称空间块中的缩进之外,一切都正常

我有示例代码:

$ cat test2.cc
#include <iostream>

namespace API
{
void f ()
{
    std::cout << "f() called" << std::endl;
}
}

我不想第一次缩进名称空间块,也不想很难找到任何相关的缩进选项(这非常复杂)。我怎么才能算出来?如果您有任何建议,我们将不胜感激。

indent
旨在格式化C代码。它并不真正了解C++语法,比如<代码>命名空间< /C> > /<
<>我建议使用,这是一个C++格式化程序。

谢谢你的建议。我将检查
clangformat
$ indent -st -bl -bli0  -i 4 -c 4 -kr -nce -bls test2.cc
#include <iostream>

namespace API
{
    void f()
^^^^<=== I don't want these indentation
    {
        std::cout << "f() called" << std::endl;
    }
}