summaryrefslogtreecommitdiffstats
path: root/after/lsp/clangd.lua
diff options
context:
space:
mode:
Diffstat (limited to 'after/lsp/clangd.lua')
-rw-r--r--after/lsp/clangd.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/after/lsp/clangd.lua b/after/lsp/clangd.lua
new file mode 100644
index 0000000..b1919c8
--- /dev/null
+++ b/after/lsp/clangd.lua
@@ -0,0 +1,27 @@
+local map = require("core.misc").map
+
+return {
+ on_attach = function(_, bufnr)
+ -- add some clangd specific mappings
+ local opts = { buffer = bufnr }
+ map("n", "<leader>o", "<cmd>ClangdSwitchSourceHeader<CR>", opts)
+ end,
+
+ cmd = {
+ "clangd",
+ "--background-index",
+ "--clang-tidy",
+ "--header-insertion=iwyu",
+ "--completion-style=detailed",
+ "--function-arg-placeholders",
+ "--fallback-style=llvm"
+ },
+
+ init_options = {
+ usePlaceholders = true,
+ clangdFileStatus = true,
+ fallback_flags = {
+ "-xc" -- makes clangd think we"re using c instead of c++
+ }
+ }
+}