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