Compare commits

...

10 commits

17 changed files with 249 additions and 326 deletions

View file

@ -1,51 +1,46 @@
{ {
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, "LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, "blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
"cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" }, "cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" },
"conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" }, "conform.nvim": { "branch": "master", "commit": "5420c4b5ea0aeb99c09cfbd4fd0b70d257b44f25" },
"fidget.nvim": { "branch": "main", "commit": "4d5858bd4c471c895060e1b9f3575f1551184dc5" }, "fidget.nvim": { "branch": "main", "commit": "64463022a1f2ff1318ab22a2ea4125ed9313a483" },
"flash.nvim": { "branch": "main", "commit": "b68bda044d68e4026c4e1ec6df3c5afd7eb8e341" }, "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"fzf-lua": { "branch": "main", "commit": "7b730b69985e33c14bff3bdafd1a2c82fdfa1376" }, "fzf-lua": { "branch": "main", "commit": "b1d2b0dc146cb9260209da4d7ab754adb0a2653d" },
"git-worktree.nvim": { "branch": "main", "commit": "3ad8c17a3d178ac19be925284389c14114638ebb" }, "git-worktree.nvim": { "branch": "main", "commit": "3ad8c17a3d178ac19be925284389c14114638ebb" },
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
"gitsigns.nvim": { "branch": "main", "commit": "f780609807eca1f783a36a8a31c30a48fbe150c5" }, "gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" },
"go.nvim": { "branch": "master", "commit": "bfd135469297f7eec50b444c8a10e098ae170f00" }, "go.nvim": { "branch": "master", "commit": "41a18f0c05534c375bafec7ed05cdb409c4abcc6" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "grug-far.nvim": { "branch": "main", "commit": "bc589a1ba340a00ae40bf1436401eac5b1454687" },
"lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
"mini.ai": { "branch": "main", "commit": "dcd346a3eda9121e917950680e5eb59f59f78aae" }, "mini.ai": { "branch": "main", "commit": "bfb26d9072670c3aaefab0f53024b2f3729c8083" },
"mini.icons": { "branch": "main", "commit": "f9a177c11daa7829389b7b6eaaec8b8a5c47052d" }, "mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" },
"mini.statusline": { "branch": "main", "commit": "3c86b8a1cb67e347e91815b21662c28fd52ac144" }, "mini.statusline": { "branch": "main", "commit": "3e96596ebe51b899874d8174409cdc4f3c749d9a" },
"mini.surround": { "branch": "main", "commit": "4b92d30fb5e021cced6cbb68698c73018211fbfa" },
"nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dbee": { "branch": "master", "commit": "dda517694889a5d238d7aa407403984da9f80cc0" }, "nvim-dbee": { "branch": "master", "commit": "dda517694889a5d238d7aa407403984da9f80cc0" },
"nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
"nvim-lint": { "branch": "master", "commit": "0864f81c681e15d9bdc1156fe3a17bd07db5a3ed" }, "nvim-lint": { "branch": "master", "commit": "7a64f4067065c16a355d40d0d599b8ca6b25de6d" },
"nvim-lspconfig": { "branch": "master", "commit": "107c2458cdc780c4ed2c2b5e1b7800cd019010bd" }, "nvim-lspconfig": { "branch": "master", "commit": "361dd9d5f3f8ae3d8c721f4f2c21847050538b1f" },
"nvim-spectre": { "branch": "master", "commit": "72f56f7585903cd7bf92c665351aa585e150af0f" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
"nvim-ufo": { "branch": "main", "commit": "d31e2a9fd572a25a4d5011776677223a8ccb7e35" }, "nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" },
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, "oil.nvim": { "branch": "master", "commit": "756dec855b4811f2d27f067a3aca477f368d99f5" },
"oil.nvim": { "branch": "master", "commit": "07f80ad645895af849a597d1cac897059d89b686" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"presenterm.nvim": { "branch": "main", "commit": "2db942337aeeca99e33f627459df2264b3987634" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"quicker.nvim": { "branch": "master", "commit": "6b88ca4d70e35df877d9564beba83f00ba0c3133" }, "quicker.nvim": { "branch": "master", "commit": "ad367a8f27aff3361db43ea2f41cd505ab573617" },
"render-markdown.nvim": { "branch": "main", "commit": "67f2c7c8850bb11eefa6b22054a6f4cef1146de2" }, "rose-pine": { "branch": "main", "commit": "cf2a288696b03d0934da713d66c6d71557b5c997" },
"schemastore.nvim": { "branch": "main", "commit": "22f0c2f7c727a15b45b7bfcbbab533720223b840" }, "schemastore.nvim": { "branch": "main", "commit": "8b92ea89835b8e5dbc779a675ebb0e5fcb9a1993" },
"snacks.nvim": { "branch": "main", "commit": "d67a47739dfc652cfcf66c59e929c704a854b37a" }, "snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
"suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, "suda.vim": { "branch": "master", "commit": "c492741b4679b3cdd4d9e34138209784e061d916" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"typst-preview.nvim": { "branch": "master", "commit": "dea4525d5420b7c32eebda7de15a6beb9d6574fa" }, "typst-preview.nvim": { "branch": "master", "commit": "87d0f3a1beedefe6fdd96422c04c3dceb69d1063" },
"undotree": { "branch": "master", "commit": "fe9a9d0645f0f5532360b5e5f5c550d7bb4f1869" }, "undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" },
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
"vim-hugo": { "branch": "master", "commit": "324fb8c7371d31701349c1192e25a0bdcf9898f8" }, "vim-hugo": { "branch": "master", "commit": "324fb8c7371d31701349c1192e25a0bdcf9898f8" },
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" },
"windsurf.vim": { "branch": "main", "commit": "a8d47ec54fe82df920b2545559f767003e8a7f8d" } "windsurf.vim": { "branch": "main", "commit": "a8d47ec54fe82df920b2545559f767003e8a7f8d" }
} }

View file

@ -1,16 +1,42 @@
---@brief
---
--- https://github.com/microsoft/typescript-go
---
--- `typescript-go` is experimental port of the TypeScript compiler (tsc) and language server (tsserver) to the Go programming language.
---
--- `tsgo` can be installed via npm `npm install @typescript/native-preview`.
---
--- ### Monorepo support
---
--- `tsgo` supports monorepos by default. It will automatically find the `tsconfig.json` or `jsconfig.json` corresponding to the package you are working on.
--- This works without the need of spawning multiple instances of `tsgo`, saving memory.
---
--- It is recommended to use the same version of TypeScript in all packages, and therefore have it available in your workspace root. The location of the TypeScript binary will be determined automatically, but only once.
---
---@type vim.lsp.Config
return { return {
settings = {}, cmd = { "tsgo", "--lsp", "--stdio" },
flags = {}, filetypes = {
filetypes = { "typescript" }, "javascript",
cmd = { "javascriptreact",
"/home/mzunino/Dev/random/typescript-go/built/local", "javascript.jsx",
"--lsp", "typescript",
"-stdio", "typescriptreact",
}, "typescript.tsx",
root_markers = {
"tsconfig.json",
"package.json",
"jsconfig.json",
".git",
}, },
root_dir = function(bufnr, on_dir)
-- The project root is where the LSP can be started from
-- As stated in the documentation above, this LSP supports monorepos and simple projects.
-- We select then from the project root, which is identified by the presence of a package
-- manager lock file.
local root_markers = { "package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "bun.lock" }
-- Give the root markers equal priority by wrapping them in a table
root_markers = vim.fn.has("nvim-0.11.3") == 1 and { root_markers, { ".git" } }
or vim.list_extend(root_markers, { ".git" })
-- We fallback to the current working directory if no project root is found
local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd()
on_dir(project_root)
end,
} }

View file

@ -1,39 +0,0 @@
return {
-- explicitly add default filetypes, so that we can extend
-- them in related extras
filetypes = {
"javascript",
"javascriptreact",
"javascript.jsx",
"typescript",
"typescriptreact",
"typescript.tsx",
},
settings = {
complete_function_calls = true,
vtsls = {
enableMoveToFileCodeAction = true,
autoUseWorkspaceTsdk = true,
experimental = {
maxInlayHintLength = 30,
completion = {
enableServerSideFuzzyMatch = true,
},
},
},
typescript = {
updateImportsOnFileMove = { enabled = "always" },
suggest = {
completeFunctionCalls = true,
},
inlayHints = {
enumMemberValues = { enabled = true },
functionLikeReturnTypes = { enabled = true },
parameterNames = { enabled = "literals" },
parameterTypes = { enabled = true },
propertyDeclarationTypes = { enabled = true },
variableTypes = { enabled = false },
},
},
},
}

View file

@ -88,5 +88,8 @@ nmap("qk", "<cmd>cprev<cr>", { desc = "Previous quickfix item" })
nmap("<Esc>", "<cmd>nohlsearch<CR>", { desc = "Clear search highlights" }) nmap("<Esc>", "<cmd>nohlsearch<CR>", { desc = "Clear search highlights" })
-- Restore 's' key functionality (Mini.surround overrides it by default)
nmap("s", "cl", { desc = "Delete character and enter insert mode" })
-- Launch lazygit in a new tmux pane, exits when done -- Launch lazygit in a new tmux pane, exits when done
nmap("<leader>lg", "<cmd>!tmux new-window -c " .. vim.fn.getcwd() .. " -- lazygit <CR><CR>", { desc = "LazyGit" }) nmap("<leader>lg", "<cmd>!tmux new-window -c " .. vim.fn.getcwd() .. " -- lazygit <CR><CR>", { desc = "LazyGit" })

View file

@ -1,7 +1,7 @@
local M = { local M = {
{ {
"EdenEast/nightfox.nvim", "EdenEast/nightfox.nvim",
enabled = true, enabled = false,
priority = 1000, priority = 1000,
config = function() config = function()
vim.cmd("colorscheme nightfox") vim.cmd("colorscheme nightfox")
@ -12,7 +12,7 @@ local M = {
{ {
"rose-pine/neovim", "rose-pine/neovim",
name = "rose-pine", name = "rose-pine",
enabled = false, enabled = true,
priority = 1000, priority = 1000,
opts = { opts = {
variant = "auto", variant = "auto",

View file

@ -30,13 +30,23 @@ return {
toml = { "taplo" }, toml = { "taplo" },
typst = { "prettypst" }, typst = { "prettypst" },
java = { "google-java-format" }, java = { "google-java-format" },
nix = { "nixpkgs-fmt" }, nix = { "nixfmt" },
}, },
formatters = { formatters = {
csharpier = { csharpier = {
command = "dotnet-csharpier", command = "dotnet-csharpier",
args = { "--write-stdout" }, args = { "--write-stdout" },
}, },
["clang-format"] = {
meta = {
url = "https://clang.llvm.org/docs/ClangFormat.html",
description = "Format C/C++/JavaScript/JSON/Objective-C/Protobuf code.",
},
command = "clang-format",
args = {
"--style={BasedOnStyle: LLVM, BreakBeforeBraces: Attach, AllowShortFunctionsOnASingleLine: None}",
},
},
}, },
format_on_save = { format_on_save = {
timeout_ms = 500, timeout_ms = 500,

73
lua/plugins/grug-far.lua Normal file
View file

@ -0,0 +1,73 @@
local M = {
"MagicDuck/grug-far.nvim",
cmd = "GrugFar",
keys = {
{ "<leader>S", "<cmd>GrugFar<CR>", desc = "GrugFar: Find and Replace" },
},
}
M.config = function()
require("grug-far").setup({
-- Basic configuration
minSearchLength = 2,
debounceMs = 300,
-- UI configuration
ui = {
border = "rounded",
size = {
width = 0.8,
height = 0.8,
},
},
-- Search configuration
search = {
engines = { "ripgrep", "astgrep", "astgrep-rules" },
defaultEngine = "ripgrep",
},
-- History configuration - simplified to avoid the autoSave bug
history = {
enabled = true,
maxEntries = 50,
},
-- Result configuration
resultLocation = {
showNumberLabel = true,
},
})
-- Additional keybindings for enhanced functionality
vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("grug-far-custom-keybinds", { clear = true }),
pattern = { "grug-far" },
callback = function()
-- Toggle --fixed-strings flag
vim.keymap.set("n", "<localleader>w", function()
local state = unpack(require("grug-far").get_instance(0):toggle_flags({ "--fixed-strings" }))
vim.notify("grug-far: toggled --fixed-strings " .. (state and "ON" or "OFF"))
end, { buffer = true, desc = "Toggle fixed strings" })
-- Open result location and close grug-far
vim.keymap.set("n", "<C-enter>", function()
require("grug-far").get_instance(0):open_location()
require("grug-far").get_instance(0):close()
end, { buffer = true, desc = "Open location and close" })
-- Jump back to first input
vim.keymap.set("n", "<left>", function()
require("grug-far").get_instance(0):goto_first_input()
end, { buffer = true, desc = "Jump to first input" })
-- Toggle multiline mode
vim.keymap.set("n", "<localleader>m", function()
local state = unpack(require("grug-far").get_instance(0):toggle_flags({ "--multiline" }))
vim.notify("grug-far: toggled --multiline " .. (state and "ON" or "OFF"))
end, { buffer = true, desc = "Toggle multiline mode" })
end,
})
end
return M

View file

@ -11,7 +11,6 @@ M.config = function()
lint.linters_by_ft = { lint.linters_by_ft = {
-- fuck this shit, 1.5Gb of RAM for this crap -- fuck this shit, 1.5Gb of RAM for this crap
--
-- javascript = {"eslint_d"}, -- javascript = {"eslint_d"},
-- typescript = {"eslint_d"}, -- typescript = {"eslint_d"},
-- javascriptreact = {"eslint_d"}, -- javascriptreact = {"eslint_d"},

94
lua/plugins/lsp.lua Normal file
View file

@ -0,0 +1,94 @@
local M = {
"neovim/nvim-lspconfig",
dependencies = {
{
"folke/lazydev.nvim",
ft = "lua",
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
{
"j-hui/fidget.nvim",
opts = {},
},
{
"ray-x/go.nvim",
ft = "go",
config = function(_, opts)
require("go").setup(opts)
vim.keymap.set("n", "<leader>gmt", ":GoModTidy<cr>", {
desc = "[Go] Tidy",
})
end,
build = function()
vim.cmd([[silent! GoModTidy]])
end,
},
},
}
function M.config()
local lspconfig = require("lspconfig")
vim.lsp.enable({ "tsgo" })
local servers = {
"gopls",
"jsonls",
"clangd",
"lua_ls",
"yamlls",
"graphql",
"html",
"cssls",
"omnisharp",
"svelte",
"templ",
"tinymist",
"jdtls",
"nixd",
"qmlls",
"zls",
}
for _, server in ipairs(servers) do
lspconfig[server].setup({})
end
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
callback = function(ev)
local opts = { buffer = ev.buf, silent = true }
local client = vim.lsp.get_client_by_id(ev.data.client_id)
nmap("K", vim.lsp.buf.hover, vim.tbl_extend("force", opts, { desc = "Hover Doc" }))
nmap("<C-h>", vim.lsp.buf.signature_help, vim.tbl_extend("force", opts, { desc = "Signature Help" }))
nmap("<leader>r", vim.lsp.buf.rename, vim.tbl_extend("force", opts, { desc = "Rename" }))
nmap("<leader>ca", vim.lsp.buf.code_action, vim.tbl_extend("force", opts, { desc = "Code Action" }))
nmap("vd", vim.diagnostic.open_float, vim.tbl_extend("force", opts, { desc = "View Diagnostics" }))
nmap("<leader>lr", "<cmd>LspRestart<CR>", vim.tbl_extend("force", opts, { desc = "Restart LSP" }))
if client and client.server_capabilities.documentHighlightProvider then
local hl_group = vim.api.nvim_create_augroup("lsp_document_highlight_" .. ev.buf, { clear = true })
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
group = hl_group,
buffer = ev.buf,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
group = hl_group,
buffer = ev.buf,
callback = vim.lsp.buf.clear_references,
})
end
end,
})
end
return M
--

View file

@ -1,13 +0,0 @@
return {
"ray-x/go.nvim",
ft = "go",
config = function(_, opts)
require("go").setup(opts)
vim.keymap.set("n", "<leader>gmt", ":GoModTidy<cr>", {
desc = "[Go] Tidy",
})
end,
build = function()
vim.cmd([[silent! GoModTidy]])
end,
}

View file

@ -1,9 +0,0 @@
return {
"folke/lazydev.nvim",
ft = "lua",
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
}

View file

@ -1,182 +0,0 @@
return {
"neovim/nvim-lspconfig",
dependencies = {
require("plugins.lsp.extras.lazydev"),
require("plugins.lsp.extras.gopher"),
"j-hui/fidget.nvim",
"ibhagwan/fzf-lua",
},
config = function()
require("fidget").setup({})
-- Enhance floating preview windows
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
opts = opts or {}
opts.border = opts.border or "rounded"
opts.max_width = opts.max_width or 80
opts.max_height = opts.max_height or 20
return orig_util_open_floating_preview(contents, syntax, opts, ...)
end
-- Diagnostics configuration
vim.diagnostic.config({
virtual_text = { spacing = 2, source = "if_many" },
float = { border = "rounded", source = "if_many" },
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 true,
underline = true,
update_in_insert = true,
severity_sort = true,
})
-- Global floating options
_G.floating_options = {
focusable = true,
focus = false,
max_height = 50,
max_width = 100,
}
-- Auto-format on save
vim.api.nvim_create_autocmd("BufWritePre", {
callback = function()
if vim.lsp.buf_is_attached() then
vim.lsp.buf.format()
end
end,
})
-- Filter out unwanted code actions
vim.lsp.buf.code_action = (function(orig)
return function(opts)
opts = opts or {}
opts.filter = function(action)
if not action then
return false
end
-- Ignore gopls "Browse" actions
if action.title and action.title:match("Browse gopls") then
return false
end
return true
end
return orig(opts)
end
end)(vim.lsp.buf.code_action)
-- Keymaps setup function
local function setup_keymaps(bufnr)
local fzf = require("fzf-lua")
local opts = { buffer = bufnr }
-- Helper function for mapping
local function nmap(key, func, desc_opts)
vim.keymap.set("n", key, func, desc_opts)
end
-- Basic LSP
nmap("K", vim.lsp.buf.hover, vim.tbl_extend("force", opts, { desc = "Hover Doc" }))
nmap("<C-h>", vim.lsp.buf.signature_help, vim.tbl_extend("force", opts, { desc = "Signature Help" }))
nmap("<leader>r", vim.lsp.buf.rename, vim.tbl_extend("force", opts, { desc = "Rename" }))
nmap("<leader>ca", vim.lsp.buf.code_action, vim.tbl_extend("force", opts, { desc = "Code Action" }))
-- Navigation
nmap("gd", fzf.lsp_definitions, vim.tbl_extend("force", opts, { desc = "Go to Definition" }))
nmap("gr", fzf.lsp_references, vim.tbl_extend("force", opts, { desc = "Go to References" }))
nmap("gD", vim.lsp.buf.declaration, vim.tbl_extend("force", opts, { desc = "Go to Declaration" }))
nmap("gi", fzf.lsp_implementations, vim.tbl_extend("force", opts, { desc = "Go to Implementation" }))
nmap("gt", fzf.lsp_typedefs, vim.tbl_extend("force", opts, { desc = "Go to Type Definition" }))
-- Diagnostics
nmap("vd", vim.diagnostic.open_float, vim.tbl_extend("force", opts, { desc = "View Diagnostics" }))
nmap("<leader>dl", fzf.diagnostics_document, vim.tbl_extend("force", opts, { desc = "Document Diagnostics" }))
nmap("<leader>dw", fzf.diagnostics_workspace, vim.tbl_extend("force", opts, { desc = "Workspace Diagnostics" }))
nmap("<leader>ds", fzf.lsp_document_symbols, vim.tbl_extend("force", opts, { desc = "Document Symbols" }))
nmap("<leader>ws", fzf.lsp_workspace_symbols, vim.tbl_extend("force", opts, { desc = "Workspace Symbols" }))
-- LSP management
nmap("<leader>lr", function()
local clients = vim.lsp.get_clients({ bufnr = bufnr })
if #clients == 0 then
vim.notify("No LSP clients attached to buffer", vim.log.levels.WARN)
return
end
local client_names = {}
for _, client in ipairs(clients) do
table.insert(client_names, client.name)
vim.cmd("LspRestart " .. client.name)
end
vim.notify("Restarted LSP clients: " .. table.concat(client_names, ", "), vim.log.levels.INFO)
end, vim.tbl_extend("force", opts, { desc = "Restart LSP" }))
nmap("<leader>li", ":LspInfo<CR>", vim.tbl_extend("force", opts, { desc = "LSP Info" }))
end
local lspconfig = require("lspconfig")
-- Lista de servidores LSP a habilitar
local servers = {
"gopls",
"jsonls",
"clangd",
"lua_ls",
"yamlls",
"graphql",
"html",
"cssls",
"omnisharp",
"svelte",
"templ",
"tinymist",
"jdtls",
-- "ts_ls",
"nixd",
}
-- Setup automático - Neovim 11 carga las configs automáticamente
for _, server in ipairs(servers) do
lspconfig[server].setup({})
end
-- LSP Attach autocmd
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", { clear = true }),
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if not client then
return
end
-- Setup keymaps
setup_keymaps(args.buf)
-- Inlay hints
if client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, args.buf) then
vim.keymap.set("n", "<leader>th", function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = args.buf }), { bufnr = args.buf })
end, { buffer = args.buf, desc = "Toggle Inlay Hints" })
end
-- Document highlights
if client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
buffer = args.buf,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
buffer = args.buf,
callback = vim.lsp.buf.clear_references,
})
end
end,
})
end,
}

View file

@ -17,18 +17,6 @@ local M = {
require("mini.ai").setup({ n_lines = 500 }) require("mini.ai").setup({ n_lines = 500 })
end, 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,
},
{ {
"echasnovski/mini.statusline", "echasnovski/mini.statusline",
version = false, version = false,

View file

@ -1,22 +0,0 @@
local M = {
"nvim-pack/nvim-spectre",
}
M.config = function()
require("spectre").setup()
nmap("<leader>S", '<cmd>lua require("spectre").toggle()<CR>', {
desc = "Toggle Spectre",
})
nmap("<leader>sw", '<cmd>lua require("spectre").open_visual({select_word=true})<CR>', {
desc = "[Spectre] Search current word",
})
nmap("<leader>sw", '<esc><cmd>lua require("spectre").open_visual()<CR>', {
desc = "[Spectre] Search current word",
})
nmap("<leader>sp", '<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', {
desc = "[Spectre] Search on current file",
})
end
return M