This commit is contained in:
dlond 2025-05-30 06:11:14 +12:00
parent 8cfb2a3019
commit a0f8c507c0
1 changed files with 6 additions and 18 deletions

View File

@ -127,24 +127,12 @@ return {
'neovim/nvim-lspconfig',
ft = M.clang_filetypes,
config = function()
vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('clangd-lazy-init', { clear = true }),
pattern = table.concat(M.clang_filetypes, ','),
callback = function(args)
local ft = vim.bo[args.buf].filetype
if vim.tbl_contains(M.clang_filetypes, ft) then
local dir = find_compile_commands()
M.start_clangd(dir)
if dir ~= '' then
M.watch_compile_commands(dir)
else
M.watch_compile_commands()
end
local dir = find_compile_commands()
M.start_clangd(dir)
if dir ~= '' then
M.watch_compile_commands(dir)
end
vim.keymap.set('n', '<leader>cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd', buffer = args.buf })
vim.api.nvim_clear_autocmds { group = 'clangd-lazy-init' }
end
end,
})
vim.keymap.set('n', '<leader>cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' })
end,
}