A tiny helper for C/C++ projects: pick a compile_commands.json, generate
a repo-local .clangd that points to it, and restart clangd with the right
--target, --sysroot, and -isystem include dirs derived from your
compiler.
- Telescope picker to choose among multiple
compile_commands.jsonin a repo - Infers compiler, language, target, sysroot, and system include paths
- Writes a minimal
.clangdwithCompilationDatabase+ flags - Restarts
clangdfor the repository automatically
- Neovim 0.10+
- telescope.nvim
- A working toolchain (clang/gcc) in
$PATH
{
"adamatom/clangd-db-picker.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
keys = {
{
"<leader>cc",
"<cmd>ClangdDbPick<cr>",
desc = "Pick compile_commands.json (clangd-db-picker)",
},
},
config = function()
require("clangd_db_picker").setup({
-- extra_isystem = {"/opt/toolchain/include"},
})
end,
}