Files
LazyVim/lua/lazyvim/plugins/extras/lang/cmake.lua

74 lines
1.6 KiB
Lua

return {
recommended = function()
return LazyVim.extras.wants({
ft = "cmake",
root = { "CMakePresets.json", "CTestConfig.cmake", "cmake" },
})
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "cmake" })
end
end,
},
{
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = vim.list_extend(opts.sources or {}, {
nls.builtins.diagnostics.cmake_lint,
})
end,
},
{
"mfussenegger/nvim-lint",
optional = true,
opts = {
linters_by_ft = {
cmake = { "cmakelint" },
},
},
},
{
"mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "cmakelang", "cmakelint" })
end,
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
neocmake = {},
},
},
},
{
"Civitasv/cmake-tools.nvim",
lazy = true,
init = function()
local loaded = false
local function check()
local cwd = vim.uv.cwd()
if vim.fn.filereadable(cwd .. "/CMakeLists.txt") == 1 then
require("lazy").load({ plugins = { "cmake-tools.nvim" } })
loaded = true
end
end
check()
vim.api.nvim_create_autocmd("DirChanged", {
callback = function()
if not loaded then
check()
end
end,
})
end,
opts = {},
},
}