Closed myl7 closed 3 years ago
Though this is not standard behavior of clang-format
If this is not standard behavior, how will clangformat take these file locations into account?
According to the doc, clang-format will use the .clang-format
file located in the closest parent directory, so ~/.clang-format
may be used if the project is in the home dir and no other .clang-format
files are found.
As the plugin checks .clang-format
in the current dir to determine whether to apply the default generated clang-format style options, I think additionally searching ~/.clang-format
may make sense.
So this change breaks the case where the current project is not beneath the home folder while a ~/.clang-format
still exists.
But since this sounds very unlikely (why would you have ~/.clang-format
if vim-autoformat doesn't look at it) I think this can be merged.
Putting a
.clang-format
file in every C++/C project is troublesome, and single file C++/C test-purpose projects are common. There are also widely-used C++/C code styles like Google that may be used in someone's almost all projects.The PR tries to search
~/.clang-format
and~/_clang-format
after searching.clang-format
and_clang-format
.Though this is not standard behavior of clang-format, the PR may make it more convenient for developers.