chore: use mini modules instead of the whole repo

This commit is contained in:
Mariano Z. 2024-12-23 14:21:17 -03:00
parent 99bcb4ca97
commit 519f262227
Signed by: marianozunino
GPG key ID: 4C73BAD25156DACE
5 changed files with 67 additions and 33 deletions

View file

@ -20,6 +20,8 @@ return {
go = { "gofumpt", "goimports-reviser", "golines" },
cs = { "csharpier" },
templ = { "templ" },
c = { "clang-format" },
cpp = { "clang-format" },
},
formatters = {
csharpier = {

View file

@ -10,6 +10,7 @@ local M = {
},
}
-- Set up autocommands for document highlights
local function setup_autocommands(client, bufnr)
if client.server_capabilities.documentHighlightProvider then
local group = vim.api.nvim_create_augroup("LSPDocumentHighlight", { clear = true })
@ -26,6 +27,7 @@ local function setup_autocommands(client, bufnr)
end
end
-- Set up key mappings for LSP functionality
local function setup_keymaps(bufnr)
local keymaps = {
{ "<C-h>", vim.lsp.buf.signature_help, "Signature Help" },
@ -44,6 +46,7 @@ local function setup_keymaps(bufnr)
end
end
-- Function called when LSP attaches to a buffer
local function on_attach(client, bufnr)
setup_autocommands(client, bufnr)
setup_keymaps(bufnr)
@ -51,12 +54,14 @@ end
local BORDER = "rounded"
-- Customize hover and signature help handlers
local handlers = {
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = BORDER }),
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = BORDER }),
}
function M.config()
-- Set up Mason
require("mason").setup({
max_concurrent_installers = 4,
})
@ -79,12 +84,14 @@ function M.config()
"shfmt",
"stylua",
"latexindent",
"clang-format",
-- Additional tools
"eslint_d",
"templ",
}
-- Install missing tools
local registry = require("mason-registry")
for _, tool in ipairs(ensure_installed) do
if not registry.is_installed(tool) then
@ -92,6 +99,7 @@ function M.config()
end
end
-- Set up Mason LSP config
require("mason-lspconfig").setup({
automatic_installation = true,
ensure_installed = {
@ -118,22 +126,31 @@ function M.config()
on_attach = on_attach,
capabilities = capabilities,
handlers = handlers,
flags = {
debounce_text_changes = 150,
},
flags = { debounce_text_changes = 150 },
}
-- Try to load server-specific configuration
-- Load server-specific configuration if it exists
local ok, server_opts = pcall(require, "plugins.lsp.servers." .. server_name)
if ok then
base_opts = vim.tbl_deep_extend("force", base_opts, server_opts)
end
-- Set up the LSP server
-- Set up the LSP server with the combined options
require("lspconfig")[server_name].setup(base_opts)
end,
},
})
-- Set up non-Mason LSP servers
local non_mason_servers = { "ccls" }
for _, server in ipairs(non_mason_servers) do
require("lspconfig")[server].setup({
on_attach = on_attach,
capabilities = require("blink.cmp").get_lsp_capabilities(),
handlers = handlers,
flags = { debounce_text_changes = 150 },
})
end
end
return M

View file

@ -1,24 +1,34 @@
return {
"echasnovski/mini.nvim",
config = function()
require("mini.icons").setup()
local M = {
-- - va) - [V]isually select [A]round [)]paren
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
-- - ci' - [C]hange [I]nside [']quote
require("mini.ai").setup({ n_lines = 500 })
-- Add/delete/replace surroundings (brackets, quotes, etc.)
--
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require("mini.surround").setup({})
end,
init = function()
package.preload["nvim-web-devicons"] = function()
require("mini.icons").mock_nvim_web_devicons()
return package.loaded["nvim-web-devicons"]
end
end,
{
"echasnovski/mini.icons",
init = function()
package.preload["nvim-web-devicons"] = function()
require("mini.icons").mock_nvim_web_devicons()
return package.loaded["nvim-web-devicons"]
end
end,
},
{
"echasnovski/mini.ai",
config = function()
-- - va) - [V]isually select [A]round [)]paren
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
-- - ci' - [C]hange [I]nside [']quote
require("mini.ai").setup({ n_lines = 500 })
end,
},
{
"echasnovski/mini.surround",
config = function()
-- Add/delete/replace surroundings (brackets, quotes, etc.)
--
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require("mini.surround").setup({})
end,
},
}
return M

View file

@ -5,6 +5,8 @@ local M = {
priority = 1000,
config = function()
vim.cmd("colorscheme nightfox")
vim.api.nvim_set_hl(0, "Visual", { bg = "#1f4b6d", fg = "#ffffff" })
vim.api.nvim_set_hl(0, "VisualNOS", { bg = "#1f4b6d", fg = "#ffffff" })
end,
},
{