diff options
author | Squibid <me@zacharyscheiman.com> | 2025-01-24 13:56:11 -0600 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2025-01-24 13:56:11 -0600 |
commit | 8eaa615596be321a3be12378c5e7d65cc7e482b6 (patch) | |
tree | 53fe601048ea302962420de4feff465e4c7d9317 /lua/lsps | |
parent | a0ebc39b59a98a69fbb6abf150f86dc4e19987a3 (diff) | |
download | nvim-master.tar.gz nvim-master.tar.bz2 nvim-master.zip |
Diffstat (limited to 'lua/lsps')
-rw-r--r-- | lua/lsps/clangd.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lua/lsps/clangd.lua b/lua/lsps/clangd.lua new file mode 100644 index 0000000..05ebfb7 --- /dev/null +++ b/lua/lsps/clangd.lua @@ -0,0 +1,31 @@ +local map = require('core.misc').map + +return function(server_name, attach, capabilities) + require('lspconfig')[server_name].setup { + on_attach = function(client, bufnr) + attach(client, bufnr) + + -- add some clangd specific mappings + local opts = { buffer = bufnr } + map("n", "<leader>o", "<cmd>ClangdSwitchSourceHeader<CR>", opts) + end, + capabilities = capabilities, + + 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++ + } + } + } +end |