X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/71d8ed08696bb8e807b1d1518c55fd5885ed8c98..7d854464d9b1bd386b0eaf25f38ac3b96dd1fc18:/nvim/lua/plugins/lang/cmake.lua diff --git a/nvim/lua/plugins/lang/cmake.lua b/nvim/lua/plugins/lang/cmake.lua new file mode 100644 index 0000000..2e76835 --- /dev/null +++ b/nvim/lua/plugins/lang/cmake.lua @@ -0,0 +1,60 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = { ensure_installed = { "cmake" } }, + }, + { + "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 = { ensure_installed = { "cmakelang", "cmakelint" } }, + }, + { + "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 = {}, + }, +}