This commit is contained in:
dlond 2025-05-30 06:03:40 +12:00
parent 42b3ab7480
commit 15ab4eb340
1 changed files with 3 additions and 3 deletions

View File

@ -127,9 +127,9 @@ return {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
ft = M.clang_filetypes, ft = M.clang_filetypes,
config = function() config = function()
vim.api.nvim_create_autocmd('BufReadPost', { vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('clangd-lazy-init', { clear = true }), group = vim.api.nvim_create_augroup('clangd-lazy-init', { clear = true }),
pattern = '*', pattern = table.concat(M.clang_filetypes, ','),
callback = function(args) callback = function(args)
local ft = vim.bo[args.buf].filetype local ft = vim.bo[args.buf].filetype
if vim.tbl_contains(M.clang_filetypes, ft) then if vim.tbl_contains(M.clang_filetypes, ft) then
@ -141,7 +141,7 @@ return {
M.watch_compile_commands() M.watch_compile_commands()
end end
vim.keymap.set('n', '<leader>cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) 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' } vim.api.nvim_clear_autocmds { group = 'clangd-lazy-init' }
end end
end, end,