just found out that clangd-lsp supports reading the .clang-format
file,
and apply the formatting options to a current project in nvim.
to make it work just create .clang-format
file in the project root:
BasedOnStyle: Chromium
TabWidth: 4
IndentWidth: 4
UseTab: Always
ColumnLimit: 120
then ask LSP to reformat your code with :lua vim.lsp.buf.format()
.
docs: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
configuration generator: https://zed0.co.uk/clang-format-configurator/
see also compile_commands.json