run mason in masonInstallAll cmd

This commit is contained in:
siduck 2024-06-01 06:46:29 +05:30
parent d2f98ccd26
commit 722b42f2c9

View File

@ -55,11 +55,15 @@ return {
require("mason").setup(opts) require("mason").setup(opts)
-- custom nvchad cmd to install all mason binaries listed -- custom nvchad cmd to install all mason binaries listed
vim.api.nvim_create_user_command('MasonInstallAll', function() vim.api.nvim_create_user_command("MasonInstallAll", function()
if opts.ensure_installed and #opts.ensure_installed > 0 then if opts.ensure_installed and #opts.ensure_installed > 0 then
vim.cmd "Mason"
for _, tool in ipairs(opts.ensure_installed) do for _, tool in ipairs(opts.ensure_installed) do
local p = require('mason-registry').get_package(tool) local p = require("mason-registry").get_package(tool)
if not p:is_installed() then p:install() end if not p:is_installed() then
p:install()
end
end end
end end
end, {}) end, {})