lazy clangd
This commit is contained in:
parent
22b264311a
commit
f6d5957079
|
@ -137,21 +137,22 @@ end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
ft = M.clang_filetypes,
|
|
||||||
config = function()
|
config = function()
|
||||||
vim.api.nvim_create_autocmd('BufReadPost', {
|
vim.api.nvim_create_autocmd('BufReadPost', {
|
||||||
group = vim.api.nvim_create_augroup('clangd-once', { clear = true }),
|
group = vim.api.nvim_create_augroup('clangd-once', { clear = true }),
|
||||||
pattern = '*',
|
pattern = '*',
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local ft = vim.bo[args.buf].filetype
|
local ft = vim.bo[args.buf].filetype
|
||||||
if vim.tbl_contains(require('custom.plugins.lsp.clangd').clang_filetypes, ft) then
|
if vim.tbl_contains(M.clang_filetypes, ft) then
|
||||||
local M = require 'custom.plugins.lsp.clangd'
|
|
||||||
local dir = M.find_compile_commands()
|
local dir = M.find_compile_commands()
|
||||||
M.start_clangd(dir)
|
M.start_clangd(dir)
|
||||||
vim.api.nvim_clear_autocmds { group = 'clangd-once' }
|
vim.api.nvim_clear_autocmds { group = 'clangd-once' }
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
vim.keymap.set('n', '<leader>lc', M.pick_commands_dir, { desc = '[L]ocate [c]ompile_commands.json for clangd' })
|
|
||||||
|
vim.keymap.set('n', '<leader>lc', M.pick_commands_dir, {
|
||||||
|
desc = '[L]ocate [c]ompile_commands.json for clangd',
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue