Skip to content

配置文件

安装

首先安装clang-format

sudo apt install clang-format

配置

执行如下命令,生成Google风格C++配置文件:

clang-format -style=google -dump-config > .clang-format

生成得到YAML格式配置文件.clang-format

修改

修改部分选项,更符合个人需求:

  1. tab宽度从8修改为4
#TabWidth:        8
TabWidth:        4
  1. indent宽度从2修改为4
#IndentWidth:     2
IndentWidth:     4