Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.clang_format style file not used #52

Open
CodingJonas opened this issue Oct 12, 2016 · 7 comments
Open

.clang_format style file not used #52

CodingJonas opened this issue Oct 12, 2016 · 7 comments

Comments

@CodingJonas
Copy link

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 set
let g:clang_format#detect_style_file = 1

in my vimrc. Does the plugin conflict with other plugins? What could be the problem?

@lopippo
Copy link

lopippo commented Dec 19, 2016

Are you sure you should not put that .clang-format file in the source directory?

@rhysd
Copy link
Owner

rhysd commented Dec 21, 2016

Please give me the information which enables me to reproduce the problem. At least in my environment it looks working.

@andmer
Copy link

andmer commented Feb 6, 2017

i have a .clang_format in ~/.clang_format
does it pick up that global config if no local one is present in CWD?

@k-o-ta
Copy link

k-o-ta commented Feb 19, 2017

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

@1pakch
Copy link

1pakch commented May 2, 2018

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.

@ghost
Copy link

ghost commented Aug 30, 2018

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.

@r7vme
Copy link

r7vme commented Oct 5, 2019

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:

  1. clang-format -style=Google -dump-config > ~/.clang-format
  2. update ~/.clang-format with values from g:clang_format#style_options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants