clang-format

keil:

导出style:

clang-format -style="Microsoft" --dump-config > c:\Microsoft.clang-format

Arguments:

-style=file:c:\Microsoft.clang-format -i !E

-style=mozilla -i !E 

-style=Microsoft -i !E

 

https://www.cnblogs.com/__tudou__/p/13322854.html

 

 

iar:

Menu Text: Clang Format

Command: C:\Program Files\LLVM\bin\clang-format.exe

Argument: --style=file $FILE_PATH$ -i

Initial Directory: $FILE_DIR$

 

source insight :

"C:\Program Files\LLVM\bin\clang-format.exe" --style=Microsoft -i %f

 

 

批量格式化脚本:

#!/usr/bin/bash

#设置文件夹路径
DIR=""
 
#使用find命令找到文件夹下所有的源代码文件,然后逐个格式化
find "$DIR" -name '*.c' -o -name '*.h' | while read -r file
do
  clang-format --style=Microsoft -i "$file" 
done
echo "done .."

 

手动命令

clang-format -style=google -i demo.cpp
posted @ 2023-11-06 11:04  微笑的''80  阅读(43)  评论(0)    收藏  举报