clean up masoninstall cmd func : a5c95d346d

now users no longer need to have ensure_installed!
This commit is contained in:
siduck 2024-06-29 14:49:05 +05:30
parent 0f0141f098
commit 7b73d1111c
2 changed files with 1 additions and 18 deletions

View File

@ -1,8 +1,6 @@
dofile(vim.g.base46_cache .. "mason") dofile(vim.g.base46_cache .. "mason")
local options = { local options = {
ensure_installed = { "lua-language-server", "stylua" }, -- not an option from mason.nvim
PATH = "skip", PATH = "skip",
ui = { ui = {

View File

@ -105,24 +105,9 @@ return {
config = function(_, opts) config = function(_, opts)
require("mason").setup(opts) require("mason").setup(opts)
-- 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 require("nvchad.mason").install_all(opts.ensure_installed)
vim.cmd "Mason"
local mr = require "mason-registry"
mr.refresh(function()
for _, tool in ipairs(opts.ensure_installed) do
local p = mr.get_package(tool)
if not p:is_installed() then
p:install()
end
end
end)
end
end, {}) end, {})
vim.g.mason_binaries_list = opts.ensure_installed
end, end,
}, },