Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lua/modules/configs/completion/formatters/clang_format.lua
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
return { "-style={ BasedOnStyle: LLVM, IndentWidth: 4 }" }
local project_root = vim.fs.root(vim.fn.getcwd(), { ".git" }) or vim.fn.getcwd()

-- check if ".clang-format" config exists, if it does, use the config instead of default
if not vim.uv.fs_stat(vim.fs.joinpath(project_root, ".clang-format")) then
return { "-style={ BasedOnStyle: LLVM, IndentWidth: 4 }" }
end
return {}