wip plugins: refactoring

Co-Authored-by: iGor milhit <igor@milhit.ch>
iGor milhit 2025-12-19 12:32:14 +01:00
parent 21bb2a4393
commit f931dfb794
Signed by: igor
GPG Key ID: 692D97C3D0228A99
5 changed files with 92 additions and 35 deletions

View File

@ -1,10 +0,0 @@
-- Install lsp-zero, to ease LSP support configuration
-- https://lsp-zero.netlify.app
-- https://github.com/VonHeikemen/lsp-zero.nvim/
return {
"VonHeikemen/lsp-zero.nvim",
branch = "v4.x",
lazy = true,
config = false,
}

View File

@ -0,0 +1,66 @@
-- New LSP configuration (since neovim 0.11+)
return {
'mason-org/mason-lspconfig.nvim',
dependencies = {
'mason-org/mason.nvim',
'neovim/nvim-lspconfig',
'WhoIsSethDaniel/mason-tool-installer.nvim',
},
config = function()
require("mason").setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
}
}
})
require("mason-tool-installer").setup({
ensure_installed = {
"prettier",
"ruff",
"stylua",
"tree-sitter-cli",
}
})
require("mason-lspconfig").setup({
ensure_installed = {
"cssls",
"html",
"jsonls",
"lua_ls",
"marksman",
"ruff",
"yamlls",
},
})
vim.lsp.config.marksman = {
filetypes = { "markdown", "quarto" },
root_dir = vim.fs.root(0, {
".git",
".marksman.toml",
"._quarto.yml"
})
}
vim.lsp.config.jsonls = {
settings = {
json = {
schemas = require('schemastore').json.schemas(),
validate = { enable = true },
}
}
}
vim.lsp.config('*', {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
})
end
}

View File

@ -13,7 +13,7 @@ return {
}, },
config = function() config = function()
-- Import lsp-zero -- Import lsp-zero
local lsp_zero = require("lsp-zero") -- local lsp_zero = require("lsp-zero")
-- Activate some functionalities when a LSP is activated to the current -- Activate some functionalities when a LSP is activated to the current
-- file -- file
@ -137,24 +137,24 @@ return {
) )
end end
lsp_zero.extend_lspconfig({ -- lsp_zero.extend_lspconfig({
-- Display diagnostic signs in the sign column -- -- Display diagnostic signs in the sign column
sign_text = true, -- sign_text = true,
-- Attach the keymap function -- -- Attach the keymap function
lsp_attach = lsp_attach, -- lsp_attach = lsp_attach,
-- Extend the default completion capabilities by LSP suggestions -- -- Extend the default completion capabilities by LSP suggestions
capabilities = require("cmp_nvim_lsp").default_capabilities(), -- capabilities = require("cmp_nvim_lsp").default_capabilities(),
}) -- })
--
-- Use lsp_zero to configure interface -- -- Use lsp_zero to configure interface
lsp_zero.ui({ -- lsp_zero.ui({
float_border = "rounded", -- float_border = "rounded",
sign_text = { -- sign_text = {
error = "", -- error = " ",
warn = "", -- warn = " ",
hint = "󰠠 ", -- hint = "󰠠 ",
info = "", -- info = " ",
}, -- },
}) -- })
end, end,
} }

View File

@ -44,10 +44,7 @@ return {
}) })
mason_lspconfig.setup({ mason_lspconfig.setup({
-- LSP to be installed by default -- https://github.com/mason-org/mason-lspconfig.nvim?tab=readme-ov-file#default-configuration
-- Available LSP: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
-- LSP can be installed with :Mason
-- But installing LSP through the following list is better
ensure_installed = { ensure_installed = {
"cssls", "cssls",
"html", "html",
@ -62,7 +59,7 @@ return {
function(server_name) function(server_name)
-- Activate all LSP from the ensure_installed list with its default -- Activate all LSP from the ensure_installed list with its default
-- configuration -- configuration
lspconfig[server_name].setup({}) vim.lsp.enable(server_name)
end, end,
-- Then, configure each LSP as needed -- Then, configure each LSP as needed

View File

@ -110,6 +110,7 @@ return {
}, },
}, },
{ name = "path" }, { name = "path" },
{ name = "ruff" },
{ name = "emoji" }, { name = "emoji" },
}), }),
@ -128,10 +129,13 @@ return {
nvim_lua = "[Lua]", nvim_lua = "[Lua]",
lazydev = "[Lazydev]", lazydev = "[Lazydev]",
path = "[Path]", path = "[Path]",
ruff = "[Ruff]",
emoji = "[Emoji]", emoji = "[Emoji]",
}, },
}), }),
}, },
}) })
end, end,