mirror of
https://github.com/marianozunino/nvim.git
synced 2025-06-28 10:33:49 -03:00
dev: automated commit - 2025-05-15 22:52:48
This commit is contained in:
parent
6fb744cdae
commit
05ffc3930b
4 changed files with 180 additions and 198 deletions
|
@ -1,23 +1,23 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" },
|
||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||
"blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" },
|
||||
"cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" },
|
||||
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
|
||||
"conform.nvim": { "branch": "master", "commit": "2b2b30260203af3b93a7470ac6c8457ddd6e32d9" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"fzf-lua": { "branch": "main", "commit": "b11467c3fbfe48e4a815e4909f5c4e5b413ce6d0" },
|
||||
"fzf-lua": { "branch": "main", "commit": "57f393bb1859be3c0a4f6e45252b57a910df8be2" },
|
||||
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "1796c7cedfe7e5dd20096c5d7b8b753d8f8d22eb" },
|
||||
"go.nvim": { "branch": "master", "commit": "37ec4d9be3edef64b725bfe29684e1fe019873bc" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "e399f9748d7cfd8859747c8d6c4e9c8b4d50a1bd" },
|
||||
"go.nvim": { "branch": "master", "commit": "dcb33210fbbb560e8470bfc8354929fd8f316272" },
|
||||
"knap": { "branch": "main", "commit": "7db44d0bb760120142cc1e8f43e44976de59c2f6" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "1255518cb067e038a4755f5cb3e980f79b6ab89c" },
|
||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "75d60a8f928decd8b38897f80849768b7c540a5b" },
|
||||
"mason.nvim": { "branch": "main", "commit": "888d6ee499d8089a3a4be4309d239d6be1c1e6c0" },
|
||||
"mini.ai": { "branch": "main", "commit": "e139eb1101beb0250fea322f8c07a42f0f175688" },
|
||||
"mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" },
|
||||
"mini.statusline": { "branch": "main", "commit": "e331175f10d9f400b42523b3890841aba202ce16" },
|
||||
|
@ -25,26 +25,26 @@
|
|||
"nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||
"nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
|
||||
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "12506bdaccd94964d4fb40367e36ade1960c8947" },
|
||||
"nvim-spectre": { "branch": "master", "commit": "197150cd3f30eeb1b3fd458339147533d91ac385" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "94ea4f436d2b59c80f02e293466c374584f03b8c" },
|
||||
"nvim-lint": { "branch": "master", "commit": "fdb04e9285edefbe25a02a31a35e8fbb10fe054d" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" },
|
||||
"nvim-spectre": { "branch": "master", "commit": "72f56f7585903cd7bf92c665351aa585e150af0f" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "cac999ec9f6302d2fd4ad8a846bf8f731af6e7cf" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "3c7a3570e9c9dc198a2ad4491b0b0e51c4d4ba08" },
|
||||
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
|
||||
"oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"presenterm.nvim": { "branch": "main", "commit": "2db942337aeeca99e33f627459df2264b3987634" },
|
||||
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
||||
"quicker.nvim": { "branch": "master", "commit": "1798be71cdcb15fb84fa8054148a56e17fd391dc" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "8c33733b9af902250731539b2fe3920c76993765" },
|
||||
"schemastore.nvim": { "branch": "main", "commit": "d521e71f9d5ac1c29a7653528d4e5c66ffe229c5" },
|
||||
"quicker.nvim": { "branch": "master", "commit": "51d3926f183c2d98fbc237cc237ae0926839af3a" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "a1b0988f5ab26698afb56b9c2f0525a4de1195c1" },
|
||||
"schemastore.nvim": { "branch": "main", "commit": "ba7bad63cb96dae5a82e48310beada18e8eeafe5" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
||||
"suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||
"typst-preview.nvim": { "branch": "master", "commit": "2503b188cd2a17ce44fdd21a944a93335e935215" },
|
||||
"typst-preview.nvim": { "branch": "master", "commit": "dea4525d5420b7c32eebda7de15a6beb9d6574fa" },
|
||||
"undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "fa31d0ffeebaa59cf97a81e7f92194cced54a13f" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "e95afed23712f969f83b4857a24cf9d59114c2e6" },
|
||||
"vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" },
|
||||
"vim-dadbod-ui": { "branch": "master", "commit": "460432301a5cb280ea265ddfa15c9f3dcd1d26b7" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
|
||||
|
|
|
@ -1,28 +1,20 @@
|
|||
local M = {
|
||||
"stevearc/quicker.nvim",
|
||||
-- Set plugin to load on VimEnter instead of FileType qf to ensure diagnostics are configured early
|
||||
event = { "VimEnter" },
|
||||
-- Add an explicit dependency for diagnostics loading
|
||||
dependencies = { "nvim-lspconfig" }, -- Assuming you're using nvim-lspconfig
|
||||
event = "VimEnter",
|
||||
dependencies = { "neovim/nvim-lspconfig" },
|
||||
}
|
||||
|
||||
-- Move sign registration outside of the config function to ensure it runs early
|
||||
local function register_diagnostic_signs()
|
||||
-- Define diagnostic sign icons
|
||||
local sign_icons = {
|
||||
[vim.diagnostic.severity.ERROR] = "", -- Alternative error symbol
|
||||
[vim.diagnostic.severity.WARN] = "", -- Alternative warning
|
||||
[vim.diagnostic.severity.HINT] = "", -- Star for hints
|
||||
[vim.diagnostic.severity.INFO] = "", -- Info circle
|
||||
}
|
||||
|
||||
-- Register signs explicitly
|
||||
for severity, icon in pairs(sign_icons) do
|
||||
M.init = function()
|
||||
for severity, icon in pairs({
|
||||
[vim.diagnostic.severity.ERROR] = icons.diagnostics.Error,
|
||||
[vim.diagnostic.severity.WARN] = icons.diagnostics.Warning,
|
||||
[vim.diagnostic.severity.INFO] = icons.diagnostics.Information,
|
||||
[vim.diagnostic.severity.HINT] = icons.diagnostics.Hint,
|
||||
}) do
|
||||
local name = "DiagnosticSign" .. vim.diagnostic.severity[severity]
|
||||
vim.fn.sign_define(name, { text = icon, texthl = name })
|
||||
end
|
||||
|
||||
-- Set sign highlights for better visibility
|
||||
vim.cmd([[
|
||||
highlight DiagnosticSignError guifg=#f7768e gui=bold
|
||||
highlight DiagnosticSignWarn guifg=#e0af68 gui=bold
|
||||
|
@ -31,39 +23,38 @@ local function register_diagnostic_signs()
|
|||
]])
|
||||
end
|
||||
|
||||
-- This will now be called during setup() which happens at init
|
||||
M.init = function()
|
||||
register_diagnostic_signs()
|
||||
-- Cycle through quickfix items
|
||||
local function cycle_qf(cmd)
|
||||
local qf = vim.fn.getqflist({ size = 0, idx = 0 })
|
||||
if qf.size == 0 then
|
||||
return
|
||||
end
|
||||
if cmd == "next" then
|
||||
vim.cmd(qf.idx == qf.size and "cfirst" or "cnext")
|
||||
elseif cmd == "prev" then
|
||||
vim.cmd(qf.idx == 1 and "clast" or "cprev")
|
||||
end
|
||||
end
|
||||
|
||||
local function setup_diagnostic_config()
|
||||
-- Define prettier diagnostic icons
|
||||
local diagnostic_icons = {
|
||||
[vim.diagnostic.severity.ERROR] = "", -- More prominent error symbol
|
||||
[vim.diagnostic.severity.WARN] = "", -- Warning triangle
|
||||
[vim.diagnostic.severity.HINT] = "", -- Lightbulb for hints
|
||||
[vim.diagnostic.severity.INFO] = "", -- Information symbol
|
||||
}
|
||||
|
||||
-- Configure diagnostics
|
||||
function M.config()
|
||||
-- Diagnostic configuration using _G.icons.diagnostics
|
||||
-- local icons = _G.icons.diagnostics
|
||||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
prefix = "●",
|
||||
suffix = "",
|
||||
format = function(diagnostic)
|
||||
local icon = diagnostic_icons[diagnostic.severity] or ""
|
||||
return string.format("%s %s", icon, diagnostic.message)
|
||||
format = function(d)
|
||||
return string.format("%s %s", icons[vim.diagnostic.severity[d.severity]], d.message)
|
||||
end,
|
||||
},
|
||||
underline = true, -- Enable underline for better visibility
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
signs = {
|
||||
active = true,
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = "", -- Alternative error symbol
|
||||
[vim.diagnostic.severity.WARN] = "", -- Alternative warning
|
||||
[vim.diagnostic.severity.HINT] = "", -- Star for hints
|
||||
[vim.diagnostic.severity.INFO] = "", -- Info circle
|
||||
[vim.diagnostic.severity.ERROR] = icons.diagnostics.Error,
|
||||
[vim.diagnostic.severity.WARN] = icons.diagnostics.Warning,
|
||||
[vim.diagnostic.severity.INFO] = icons.diagnostics.Information,
|
||||
[vim.diagnostic.severity.HINT] = icons.diagnostics.Hint,
|
||||
},
|
||||
},
|
||||
float = {
|
||||
|
@ -71,42 +62,20 @@ local function setup_diagnostic_config()
|
|||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = true,
|
||||
header = "",
|
||||
prefix = "",
|
||||
format = function(diagnostic)
|
||||
local severity = vim.diagnostic.severity[diagnostic.severity]
|
||||
local icon = diagnostic_icons[diagnostic.severity] or ""
|
||||
return string.format("%s %s: %s", icon, severity:lower(), diagnostic.message)
|
||||
format = function(d)
|
||||
return string.format(
|
||||
"%s %s: %s",
|
||||
icons[vim.diagnostic.severity[d.severity]],
|
||||
vim.diagnostic.severity[d.severity]:lower(),
|
||||
d.message
|
||||
)
|
||||
end,
|
||||
},
|
||||
severity_sort = true,
|
||||
})
|
||||
end
|
||||
|
||||
local function cycle_qf(cmd)
|
||||
local qf_list_empty = vim.fn.getqflist({ size = 0 }).size == 0
|
||||
if qf_list_empty then
|
||||
return
|
||||
end
|
||||
local current_qf = vim.fn.getqflist({ idx = 0 }).idx
|
||||
local qf_size = vim.fn.getqflist({ size = 0 }).size
|
||||
if cmd == "next" then
|
||||
if current_qf == qf_size then
|
||||
vim.cmd("cfirst")
|
||||
else
|
||||
vim.cmd("cnext")
|
||||
end
|
||||
elseif cmd == "prev" then
|
||||
if current_qf == 1 then
|
||||
vim.cmd("clast")
|
||||
else
|
||||
vim.cmd("cprev")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.config()
|
||||
local opts = {
|
||||
-- Quicker setup
|
||||
require("quicker").setup({
|
||||
keys = {
|
||||
{
|
||||
">",
|
||||
|
@ -124,21 +93,19 @@ function M.config()
|
|||
},
|
||||
},
|
||||
type_icons = {
|
||||
E = " ", -- Error
|
||||
W = " ", -- Warning
|
||||
I = " ", -- Info
|
||||
N = " ", -- Note
|
||||
H = " ", -- Hint
|
||||
E = icons.diagnostics.Error .. " ",
|
||||
W = icons.diagnostics.Warning .. " ",
|
||||
I = icons.diagnostics.Information .. " ",
|
||||
N = icons.ui.Note .. " ",
|
||||
H = icons.diagnostics.Hint .. " ",
|
||||
},
|
||||
}
|
||||
require("quicker").setup(opts)
|
||||
setup_diagnostic_config()
|
||||
})
|
||||
|
||||
-- Replace the existing mappings with the cycling versions
|
||||
nmap("<a-j>", function()
|
||||
-- Quickfix navigation mappings
|
||||
vim.keymap.set("n", "<a-j>", function()
|
||||
cycle_qf("next")
|
||||
end, { desc = "Next quickfix item (cycles)" })
|
||||
nmap("<a-k>", function()
|
||||
vim.keymap.set("n", "<a-k>", function()
|
||||
cycle_qf("prev")
|
||||
end, { desc = "Previous quickfix item (cycles)" })
|
||||
end
|
||||
|
|
|
@ -2,18 +2,106 @@ local M = {
|
|||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"saghen/blink.cmp",
|
||||
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
"ibhagwan/fzf-lua",
|
||||
|
||||
require("plugins.lsp.extras.lazydev"),
|
||||
require("plugins.lsp.extras.gopher"),
|
||||
},
|
||||
}
|
||||
|
||||
-- Set up autocommands for document highlights
|
||||
local function setup_autocommands(client, bufnr)
|
||||
-- Key mappings for LSP
|
||||
local function setup_keymaps(bufnr)
|
||||
local BORDER = "rounded"
|
||||
local keymaps = {
|
||||
{ "<C-h>", vim.lsp.buf.signature_help, "Signature Help", border = BORDER },
|
||||
{ "K", vim.lsp.buf.hover, "Hover Doc", border = BORDER },
|
||||
{ "<leader>cw", vim.lsp.buf.rename, "Rename" },
|
||||
{ "<leader>r", vim.lsp.buf.rename, "Rename" },
|
||||
{ "vd", vim.diagnostic.open_float, "Open Diagnostics" },
|
||||
{ "<leader>lr", ":LspRestart<CR>", "Restart LSP" },
|
||||
{ "<leader>li", ":LspInfo<CR>", "LSP Info" },
|
||||
{ "gd", require("fzf-lua").lsp_definitions, "Go to Definition" },
|
||||
{ "gr", require("fzf-lua").lsp_references, "Go to References" },
|
||||
{ "gD", vim.lsp.buf.declaration, "Go to Declaration" },
|
||||
{ "gi", require("fzf-lua").lsp_implementations, "Go to Implementation" },
|
||||
{ "gt", require("fzf-lua").lsp_typedefs, "Go to Type Definition" },
|
||||
{ "<leader>ca", vim.lsp.buf.code_action, "Code Action" },
|
||||
{ "<leader>dl", require("fzf-lua").diagnostics_document, "Document Diagnostics" },
|
||||
{ "<leader>dw", require("fzf-lua").diagnostics_workspace, "Workspace Diagnostics" },
|
||||
{ "<leader>ds", require("fzf-lua").lsp_document_symbols, "Document Symbols" },
|
||||
{ "<leader>ws", require("fzf-lua").lsp_workspace_symbols, "Workspace Symbols" },
|
||||
}
|
||||
|
||||
for _, map in ipairs(keymaps) do
|
||||
vim.keymap.set("n", map[1], function()
|
||||
map[2](map[4] and { border = map[4] } or nil)
|
||||
end, { buffer = bufnr, desc = map[3] })
|
||||
end
|
||||
end
|
||||
|
||||
function M.config()
|
||||
-- Mason setup
|
||||
require("mason").setup({ max_concurrent_installers = 4 })
|
||||
|
||||
-- Diagnostic configuration
|
||||
vim.diagnostic.config({
|
||||
severity_sort = true,
|
||||
float = { border = "rounded", source = "if_many" },
|
||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||
signs = vim.g.have_nerd_font and {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = " ",
|
||||
[vim.diagnostic.severity.WARN] = " ",
|
||||
[vim.diagnostic.severity.INFO] = " ",
|
||||
[vim.diagnostic.severity.HINT] = " ",
|
||||
},
|
||||
} or {},
|
||||
virtual_text = {
|
||||
source = "if_many",
|
||||
spacing = 2,
|
||||
format = function(diagnostic)
|
||||
return diagnostic.message
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- Servers and tools
|
||||
local servers = {
|
||||
"gopls",
|
||||
"jsonls",
|
||||
"lua_ls",
|
||||
"yamlls",
|
||||
"graphql",
|
||||
"html",
|
||||
"jsonls",
|
||||
"omnisharp",
|
||||
"svelte",
|
||||
"vtsls",
|
||||
"ccls",
|
||||
}
|
||||
local ensure_installed = vim.tbl_filter(function(s)
|
||||
return s ~= "ccls"
|
||||
end, servers)
|
||||
vim.list_extend(ensure_installed, {
|
||||
"prettierd",
|
||||
"shfmt",
|
||||
"stylua",
|
||||
"latexindent",
|
||||
"clang-format",
|
||||
"csharpier",
|
||||
"quick-lint-js",
|
||||
"templ",
|
||||
})
|
||||
|
||||
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
|
||||
|
||||
-- Document highlight autocommands
|
||||
local function setup_autocommands(client, bufnr)
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
local group = vim.api.nvim_create_augroup("LSPDocumentHighlight", { clear = true })
|
||||
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
|
||||
|
@ -27,126 +115,41 @@ local function setup_autocommands(client, bufnr)
|
|||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- Set up key mappings for LSP functionality
|
||||
local function setup_keymaps(bufnr)
|
||||
local BORDER = "rounded"
|
||||
local keymaps = {
|
||||
{
|
||||
"<C-h>",
|
||||
function()
|
||||
vim.lsp.buf.signature_help({ border = BORDER })
|
||||
end,
|
||||
"Signature Help",
|
||||
},
|
||||
{
|
||||
"K",
|
||||
function()
|
||||
vim.lsp.buf.hover({ border = BORDER })
|
||||
end,
|
||||
"Hover Doc",
|
||||
},
|
||||
{ "<leader>cw", vim.lsp.buf.rename, "Rename" },
|
||||
{ "<leader>r", vim.lsp.buf.rename, "Rename" },
|
||||
{ "vd", vim.diagnostic.open_float, "Open Diagnostics" },
|
||||
{ "<leader>lr", ":LspRestart<CR>", "Restart LSP" },
|
||||
{ "<leader>li", ":LspInfo<CR>", "LSP Info" },
|
||||
}
|
||||
|
||||
for _, map in ipairs(keymaps) do
|
||||
nmap(map[1], map[2], {
|
||||
buffer = bufnr,
|
||||
desc = map[3],
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- Function called when LSP attaches to a buffer
|
||||
function M.on_attach(client, bufnr)
|
||||
setup_autocommands(client, bufnr)
|
||||
-- LspAttach autocommand
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
local bufnr = event.buf
|
||||
setup_keymaps(bufnr)
|
||||
end
|
||||
setup_autocommands(client, bufnr)
|
||||
|
||||
-- Function to get common LSP configuration
|
||||
function M.get_common_config()
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
-- Inlay hints toggle
|
||||
if client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, { bufnr = bufnr }) then
|
||||
vim.keymap.set("n", "<leader>th", function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }))
|
||||
end, { buffer = bufnr, desc = "Toggle Inlay Hints" })
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Enable folding capabilities
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
|
||||
return {
|
||||
on_attach = M.on_attach,
|
||||
capabilities = capabilities,
|
||||
-- Base LSP configuration
|
||||
local base_config = {
|
||||
capabilities = require("blink.cmp").get_lsp_capabilities(),
|
||||
flags = { debounce_text_changes = 150 },
|
||||
}
|
||||
end
|
||||
|
||||
function M.config()
|
||||
-- Set up Mason
|
||||
require("mason").setup({
|
||||
max_concurrent_installers = 4,
|
||||
})
|
||||
|
||||
-- Ensure all tools are installed
|
||||
local ensure_installed = {
|
||||
-- LSP servers
|
||||
"gopls",
|
||||
"jsonls",
|
||||
"lua_ls",
|
||||
"yamlls",
|
||||
"graphql-language-service-cli",
|
||||
"html-lsp",
|
||||
"htmx-lsp",
|
||||
"json-lsp",
|
||||
"lua-language-server",
|
||||
"omnisharp",
|
||||
"yaml-language-server",
|
||||
"svelte-language-server",
|
||||
"vtsls",
|
||||
|
||||
-- Formatters
|
||||
"prettierd",
|
||||
"shfmt",
|
||||
"stylua",
|
||||
"latexindent",
|
||||
"clang-format",
|
||||
"csharpier",
|
||||
"quick-lint-js",
|
||||
|
||||
-- Additional tools
|
||||
"templ",
|
||||
}
|
||||
|
||||
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
|
||||
|
||||
-- Set up Mason LSP config
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {}, -- explicitly set to an empty table (populated via mason-tool-installer)
|
||||
automatic_installation = false,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local base_opts = M.get_common_config()
|
||||
|
||||
-- Load server-specific configuration if it exists
|
||||
local ok, server_opts = pcall(require, "config.lsp." .. server_name)
|
||||
-- Setup LSP servers
|
||||
require("mason-lspconfig").setup({ ensure_installed = {}, automatic_installation = true, automatic_enable = false })
|
||||
for _, server in ipairs(servers) do
|
||||
local config = vim.deepcopy(base_config)
|
||||
local ok, server_opts = pcall(require, "config.lsp." .. server)
|
||||
if ok then
|
||||
base_opts = vim.tbl_deep_extend("force", base_opts, server_opts)
|
||||
config = vim.tbl_deep_extend("force", config, server_opts)
|
||||
end
|
||||
|
||||
-- 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(M.get_common_config())
|
||||
require("lspconfig")[server].setup(config)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -3,8 +3,20 @@ return {
|
|||
priority = 1000,
|
||||
config = function()
|
||||
local snacks = require("snacks")
|
||||
|
||||
snacks.setup({
|
||||
bigfile = { enabled = true },
|
||||
input = {
|
||||
enabled = true,
|
||||
prompt_pos = "left",
|
||||
icon_pos = "left",
|
||||
expand = false,
|
||||
win = {
|
||||
row = 0.4,
|
||||
position = "float",
|
||||
border = "rounded",
|
||||
},
|
||||
},
|
||||
debug = { enabled = true },
|
||||
image = { enabled = true },
|
||||
indent = { enabled = true, animate = { enabled = false } },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue