我正在寻找一个clang-format设置来防止该工具删除换行符.
例如,我将我的ColumnLimit设置设置为120,这是我重新格式化一些示例代码时会发生的情况.
之前:
#include <vector>
#include <string>
std::vector<std::string> get_vec()
{
return std::vector<std::string> {
"this is a test",
"some of the lines are longer",
"than other, but I would like",
"to keep them on separate lines"
};
}
int main()
{
auto vec = get_vec();
}
Run Code Online (Sandbox Code Playgroud)
后:
#include <vector>
#include <string>
std::vector<std::string> get_vec()
{
return std::vector<std::string>{"this is a test", "some of the lines are longer", "than other, but I would like",
"to keep them on separate lines"}; …Run Code Online (Sandbox Code Playgroud)