2 -- Add C/C++ to treesitter
4 "nvim-treesitter/nvim-treesitter",
5 opts = { ensure_installed = { "c", "cpp" } },
9 "p00f/clangd_extensions.nvim",
11 config = function() end,
17 --These require codicons (https://github.com/microsoft/vscode-codicons)
24 ["template argument"] = "",
29 TranslationUnit = "",
31 TemplateTypeParm = "",
32 TemplateTemplateParm = "",
33 TemplateParamObject = "",
39 -- Correctly setup lspconfig for clangd 🚀
41 "neovim/nvim-lspconfig",
44 -- Ensure mason installs the server
47 { "<leader>ch", "<cmd>ClangdSwitchSourceHeader<cr>", desc = "Switch Source/Header (C/C++)" },
51 { "compile_commands.json", "compile_flags.txt", ".clangd"},
66 offsetEncoding = { "utf-16" },
72 "--header-insertion=iwyu",
73 "--completion-style=detailed",
74 "--function-arg-placeholders",
75 "--fallback-style=llvm",
78 usePlaceholders = true,
79 completeUnimported = true,
80 clangdFileStatus = true,
85 clangd = function(_, opts)
86 local clangd_ext_opts = rmz.lazy.opts("clangd_extensions.nvim")
87 require("clangd_extensions").setup(vim.tbl_deep_extend("force", clangd_ext_opts or {}, { server = opts }))
94 -- opts = function(_, opts)
95 -- -- TODO: make sure this works
96 -- table.insert(opts.fuzzy.sorts, 1, require("clangd_extensions.cmp_scores"))
99 { "mfussenegger/nvim-dap",
101 -- Ensure C/C++ debugger is installed
102 "williamboman/mason.nvim",
103 opts = { ensure_installed = { "codelldb" } },
106 local dap = require("dap")
107 if not dap.adapters["codelldb"] then
108 require("dap").adapters["codelldb"] = {
113 command = "codelldb",
121 for _, lang in ipairs({ "c", "cpp" }) do
122 dap.configurations[lang] = {
126 name = "Launch file",
128 return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
130 cwd = "${workspaceFolder}",
135 name = "Attach to process",
136 pid = require("dap.utils").pick_process,
137 cwd = "${workspaceFolder}",