(neovim) switch to own configuration
This commit is contained in:
parent
957ec52ca8
commit
977453fa05
51 changed files with 1145 additions and 358 deletions
45
config/common/nvim/lua/plugins/mason.lua
Normal file
45
config/common/nvim/lua/plugins/mason.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
lazy = false,
|
||||
cmd = "Mason",
|
||||
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
|
||||
build = ":MasonUpdate",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"lua-language-server",
|
||||
"terraform-ls",
|
||||
"stylua",
|
||||
},
|
||||
},
|
||||
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,
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue