Open CodingJonas opened 8 years ago
Are you sure you should not put that .clang-format file in the source directory?
Please give me the information which enables me to reproduce the problem. At least in my environment it looks working.
i have a .clang_format in ~/.clang_format does it pick up that global config if no local one is present in CWD?
I'd had the same problem when using vim-clang and vim-clang-format together.
Vim-clang and vim-calng-format use same command(ClangFormat
).
In my environment, ClangFormat
command invokes vim-clang's ClangFormat
and vim-clang's 'ClangFormta' uses LLVM style by default
let g:clang_enable_format_command = 0
inhibits vim-clang's ClangFormat
and have solved my problem.
https://github.com/justmao945/vim-clang/blob/master/plugin/clang.vim#L69-L71
I also observe that vim-clang-format does not pick up ~/.clang_format
which is picked up if I run clang-format
tool by myself.
if I set this in my ~/.vimrc file
let g:clang_format#detect_style_file = 1
then, vim-clang-format finds .clang-format
from current working directory toward it's ancestors?
or it only checks the current working directory?
from README
g:clang_format#detect_style_file
When this variable's value is 1
, vim-clang-format automatically detects(<-how does this work?) the style file like .clang-format
or _clang-format
and applies the style to formatting.
I also came across similar issue. My root cause was that default style used by plugin is google
(g:clang_format#code_style
) instead of LLVM system-wide.
So to switch to file:
clang-format -style=Google -dump-config > ~/.clang-format
~/.clang-format
with values from g:clang_format#style_options
I have a costume
.clang-format
file in my home directory. When I run vim-clang-format in gVim, it formats the code without my costume settings, although I setlet g:clang_format#detect_style_file = 1
in my vimrc. Does the plugin conflict with other plugins? What could be the problem?