How can I set .clang-format globally?

See original GitHub issue

I’m struggling with this problem for hours.

As far as I know, clangd doesn’t have -style option unlike clang-format and there’s no way to set my custom format in my coc.nvim + coc-clang environment (I found -fallback-style option but it is not customizable because it is a kind of presets).

So, is there any way to set a global formating option like vim-clang-format?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:16
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
ShellCode33commented, Aug 30, 2021

What I did to work this around is to copy my .clang-format fallback at the root of my system. Whether I edit a file in /tmp, /etc, /whatever, it will always end up using /.clang-format. This is dirty af but it works… If you have a .clang-format further down the tree it will be used instead.

1reaction
kadircetcommented, Jan 27, 2021

Sent out https://reviews.llvm.org/D95538 for the latter issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring VSC clang format with global.clang-format file
So my first approach was to relocate the clang-file into the "VSC 1.43\data" directory. My second attempt was to locate it right inside...
Read more >
ClangFormat — Clang 16.0.0git documentation
With this integration you can press the bound key and clang-format will format the current line in NORMAL and INSERT mode or the...
Read more >
How to set up clang-format in Visual Studio Code in a Vagrant ...
Define the location of the clang-format “clang-format. · Define your clang-format style. I just used Google's. · Set your editor to format on...
Read more >
ClangFormat as alternative formatter - CLion - JetBrains
If there is no .clang-format file under the project root, CLion will suggest creating it based on the current IDE code style settings....
Read more >
Clang format - Mesos - Read the Docs
Setup · Install clang-format-3.5 · Formatting Configuration · Editor Integration.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found