return { { "williamboman/mason.nvim", cmd = "Mason", keys = { { "cm", "Mason", desc = "Mason" } }, build = ":MasonUpdate", opts = { ensure_installed = { "lua-language-server", "markdown-toc", "markdownlint-cli2", "marksman", "shfmt", "stylua", "terraform-ls", "tflint", }, }, config = function(_, opts) require("mason").setup(opts) local mr = require("mason-registry") local function ensure_installed() for _, tool in ipairs(opts.ensure_installed) do if mr.has_package(tool) then local p = mr.get_package(tool) if not p:is_installed() then vim.notify("Mason: Installing " .. tool .. "...", vim.log.levels.INFO) p:install():once("closed", function() if p:is_installed() then vim.notify("Mason: Successfully installed " .. tool, vim.log.levels.INFO) else vim.notify("Mason: Failed to install " .. tool, vim.log.levels.ERROR) end end) end else vim.notify("Mason: Package '" .. tool .. "' not found", vim.log.levels.WARN) end end end if mr.refresh then mr.refresh(ensure_installed) else ensure_installed() end end, }, { "mfussenegger/nvim-lint", event = { "BufReadPre", "BufNewFile" }, config = function() require("lint").linters_by_ft = { markdown = { "markdownlint-cli2" }, terraform = { "terraform_validate" }, tf = { "terraform_validate" }, } local markdownlint = require("lint").linters["markdownlint-cli2"] markdownlint.args = { "--config", "/Users/f/.config/nvim-ftpd/linters/global.markdownlint-cli2.yaml", } vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { callback = function() require("lint").try_lint() end, }) end, }, { "stevearc/conform.nvim", event = { "BufReadPre", "BufNewFile" }, dependencies = { "mason.nvim" }, config = function() require("conform").setup({ formatters_by_ft = { ["terraform-vars"] = { "terraform_fmt" }, bash = { "shfmt" }, lua = { "stylua" }, markdown = { "markdownlint-cli2" }, sh = { "shfmt" }, terraform = { "terraform_fmt" }, tf = { "terraform_fmt" }, zsh = { "shfmt" }, }, -- format_on_save = { -- lsp_fallback = true, -- async = false, -- }, }) end, }, }