diff options
Diffstat (limited to '.config/nvim/ftplugin/c.lua')
-rw-r--r-- | .config/nvim/ftplugin/c.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/.config/nvim/ftplugin/c.lua b/.config/nvim/ftplugin/c.lua new file mode 100644 index 0000000..7443cab --- /dev/null +++ b/.config/nvim/ftplugin/c.lua @@ -0,0 +1,20 @@ +local clangd_flags = { "--background-index" } + +if O.lang.clang.cross_file_rename then + table.insert(clangd_flags, "--cross-file-rename") +end + +table.insert(clangd_flags, "--header-insertion=" .. O.lang.clang.header_insertion) + +require("lspconfig").clangd.setup { + cmd = { DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd", unpack(clangd_flags) }, + on_attach = require("lsp").common_on_attach, + handlers = { + ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = O.lang.clang.diagnostics.virtual_text, + signs = O.lang.clang.diagnostics.signs, + underline = O.lang.clang.diagnostics.underline, + update_in_insert = true, + }), + }, +} |