mirror of
				https://github.com/marianozunino/nvim.git
				synced 2025-10-29 20:00:41 -03:00 
			
		
		
		
	Compare commits
	
		
			No commits in common. "249a24b8518caeac809390160428469f98c96074" and "a2d2fcb86e6e83405ded83c1677e839796f4d74f" have entirely different histories.
		
	
	
		
			249a24b851
			...
			a2d2fcb86e
		
	
		
					 4 changed files with 51 additions and 78 deletions
				
			
		|  | @ -1,9 +1,6 @@ | ||||||
| { | { | ||||||
|     "diagnostics.globals": [ |     "diagnostics.globals": [ | ||||||
|         "Snacks" |         "Snacks" | ||||||
|     ], |  | ||||||
|     "diagnostics.disable": [ |  | ||||||
|         "duplicate-set-field" |  | ||||||
|     ] |     ] | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
|   "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": "29e982dfc96a134fecc80853c8cb8324e43e574b" }, |   "fzf-lua": { "branch": "main", "commit": "758173f499d15410ecb50c5519a41b27c33e645d" }, | ||||||
|   "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, |   "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, | ||||||
|   "gitsigns.nvim": { "branch": "main", "commit": "8b729e489f1475615dc6c9737da917b3bc163605" }, |   "gitsigns.nvim": { "branch": "main", "commit": "8b729e489f1475615dc6c9737da917b3bc163605" }, | ||||||
|   "go.nvim": { "branch": "master", "commit": "e1b763cab2cfd3c60207873dbc925c9be49913c0" }, |   "go.nvim": { "branch": "master", "commit": "e1b763cab2cfd3c60207873dbc925c9be49913c0" }, | ||||||
|  | @ -17,7 +17,7 @@ | ||||||
|   "mason-lspconfig.nvim": { "branch": "main", "commit": "67da97f8c2fd12d05427bb485ce07ee6418e0a51" }, |   "mason-lspconfig.nvim": { "branch": "main", "commit": "67da97f8c2fd12d05427bb485ce07ee6418e0a51" }, | ||||||
|   "mason-tool-installer.nvim": { "branch": "main", "commit": "75d60a8f928decd8b38897f80849768b7c540a5b" }, |   "mason-tool-installer.nvim": { "branch": "main", "commit": "75d60a8f928decd8b38897f80849768b7c540a5b" }, | ||||||
|   "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, |   "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, | ||||||
|   "mini.ai": { "branch": "main", "commit": "4b5348fac5912f1957f4c012c2e0ab0c4b865386" }, |   "mini.ai": { "branch": "main", "commit": "7f1fe86277f0e977642cf8fe15f004229f61e61a" }, | ||||||
|   "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, |   "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, | ||||||
|   "mini.statusline": { "branch": "main", "commit": "e331175f10d9f400b42523b3890841aba202ce16" }, |   "mini.statusline": { "branch": "main", "commit": "e331175f10d9f400b42523b3890841aba202ce16" }, | ||||||
|   "mini.surround": { "branch": "main", "commit": "f4307f935ad87cfe3e570dbaae485b35cce4e5ec" }, |   "mini.surround": { "branch": "main", "commit": "f4307f935ad87cfe3e570dbaae485b35cce4e5ec" }, | ||||||
|  | @ -36,7 +36,7 @@ | ||||||
|   "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": "51d3926f183c2d98fbc237cc237ae0926839af3a" }, |   "quicker.nvim": { "branch": "master", "commit": "51d3926f183c2d98fbc237cc237ae0926839af3a" }, | ||||||
|   "render-markdown.nvim": { "branch": "main", "commit": "0b0bec653f47d9d56cb80f426479ef0527814119" }, |   "render-markdown.nvim": { "branch": "main", "commit": "4a39681990fb515d00dd898de3d7bf2973805f1a" }, | ||||||
|   "schemastore.nvim": { "branch": "main", "commit": "a9ba109549de51e3b4594d39a1c07f14b9d0cfa5" }, |   "schemastore.nvim": { "branch": "main", "commit": "a9ba109549de51e3b4594d39a1c07f14b9d0cfa5" }, | ||||||
|   "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, |   "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, | ||||||
|   "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, |   "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, | ||||||
|  |  | ||||||
|  | @ -1,8 +1,8 @@ | ||||||
| local M = { | local M = { | ||||||
|   "WhoIsSethDaniel/mason-tool-installer.nvim", |   "mson-org/mason-lspconfig.nvim", | ||||||
|   dependencies = { |   dependencies = { | ||||||
|     "mason-org/mason-lspconfig.nvim", |     "mson-org/mason.nvim", | ||||||
|     "mason-org/mason.nvim", |     "WhoIsSethDaniel/mason-tool-installer.nvim", | ||||||
|     "j-hui/fidget.nvim", |     "j-hui/fidget.nvim", | ||||||
|     "ibhagwan/fzf-lua", |     "ibhagwan/fzf-lua", | ||||||
|     require("plugins.lsp.extras.lazydev"), |     require("plugins.lsp.extras.lazydev"), | ||||||
|  | @ -11,61 +11,35 @@ local M = { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| local function setup_keymaps(bufnr) | local function setup_keymaps(bufnr) | ||||||
|   local fzf = require("fzf-lua") |   local opts = { buffer = bufnr, noremap = true, silent = true } | ||||||
|   local opts = { buffer = bufnr } |   local keymaps = { | ||||||
| 
 |     { "K", vim.lsp.buf.hover, desc = "Hover Doc", border = "rounded" }, | ||||||
|   -- Basic LSP |     { "<C-h>", vim.lsp.buf.signature_help, desc = "Signature Help", border = "rounded" }, | ||||||
|   nmap("K", vim.lsp.buf.hover, vim.tbl_extend("force", opts, { desc = "Hover Doc" })) |     { "<leader>rn", vim.lsp.buf.rename, desc = "Rename" }, | ||||||
|   nmap("<C-h>", vim.lsp.buf.signature_help, vim.tbl_extend("force", opts, { desc = "Signature Help" })) |     { "<leader>ca", vim.lsp.buf.code_action, desc = "Code Action" }, | ||||||
|   nmap("<leader>r", vim.lsp.buf.rename, vim.tbl_extend("force", opts, { desc = "Rename" })) |     { "gd", require("fzf-lua").lsp_definitions, desc = "Go to Definition" }, | ||||||
|   nmap("<leader>ca", vim.lsp.buf.code_action, vim.tbl_extend("force", opts, { desc = "Code Action" })) |     { "gr", require("fzf-lua").lsp_references, desc = "Go to References" }, | ||||||
| 
 |     { "gD", vim.lsp.buf.declaration, desc = "Go to Declaration" }, | ||||||
|   -- Navigation |     { "gi", require("fzf-lua").lsp_implementations, desc = "Go to Implementation" }, | ||||||
|   nmap("gd", fzf.lsp_definitions, vim.tbl_extend("force", opts, { desc = "Go to Definition" })) |     { "gt", require("fzf-lua").lsp_typedefs, desc = "Go to Type Definition" }, | ||||||
|   nmap("gr", fzf.lsp_references, vim.tbl_extend("force", opts, { desc = "Go to References" })) |     { "<leader>vd", vim.diagnostic.open_float, desc = "View Diagnostics" }, | ||||||
|   nmap("gD", vim.lsp.buf.declaration, vim.tbl_extend("force", opts, { desc = "Go to Declaration" })) |     { "<leader>dl", require("fzf-lua").diagnostics_document, desc = "Document Diagnostics" }, | ||||||
|   nmap("gi", fzf.lsp_implementations, vim.tbl_extend("force", opts, { desc = "Go to Implementation" })) |     { "<leader>dw", require("fzf-lua").diagnostics_workspace, desc = "Workspace Diagnostics" }, | ||||||
|   nmap("gt", fzf.lsp_typedefs, vim.tbl_extend("force", opts, { desc = "Go to Type Definition" })) |     { "<leader>ds", require("fzf-lua").lsp_document_symbols, desc = "Document Symbols" }, | ||||||
| 
 |     { "<leader>ws", require("fzf-lua").lsp_workspace_symbols, desc = "Workspace Symbols" }, | ||||||
|   -- Diagnostics |     { "<leader>lr", ":LspRestart<CR>", desc = "Restart LSP" }, | ||||||
|   nmap("vd", vim.diagnostic.open_float, vim.tbl_extend("force", opts, { desc = "View Diagnostics" })) |     { "<leader>li", ":LspInfo<CR>", desc = "LSP Info" }, | ||||||
|   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" })) |   for _, map in ipairs(keymaps) do | ||||||
|   nmap("<leader>ds", fzf.lsp_document_symbols, vim.tbl_extend("force", opts, { desc = "Document Symbols" })) |     nmap(map[1], map[2], vim.tbl_extend("force", opts, { desc = map[3], border = map[4] })) | ||||||
|   nmap("<leader>ws", fzf.lsp_workspace_symbols, vim.tbl_extend("force", opts, { desc = "Workspace Symbols" })) |   end | ||||||
| 
 |  | ||||||
|   -- 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 | end | ||||||
| 
 | 
 | ||||||
| function M.config() | function M.config() | ||||||
|   require("mason").setup({ max_concurrent_installers = 4 }) |   require("mason").setup({ max_concurrent_installers = 4 }) | ||||||
|   require("fidget").setup({}) |   require("fidget").setup({}) | ||||||
| 
 | 
 | ||||||
|   local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview |   -- Diagnostic configuration | ||||||
|   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 |  | ||||||
|   vim.diagnostic.config({ |   vim.diagnostic.config({ | ||||||
|     virtual_text = { spacing = 2, source = "if_many" }, |     virtual_text = { spacing = 2, source = "if_many" }, | ||||||
|     float = { border = "rounded", source = "if_many" }, |     float = { border = "rounded", source = "if_many" }, | ||||||
|  | @ -80,6 +54,7 @@ function M.config() | ||||||
|     } or {}, |     } or {}, | ||||||
|   }) |   }) | ||||||
| 
 | 
 | ||||||
|  |   -- List of servers to enable (matching files in ~/.config/nvim/lsp/) | ||||||
|   local servers = { |   local servers = { | ||||||
|     "gopls", |     "gopls", | ||||||
|     "jsonls", |     "jsonls", | ||||||
|  | @ -94,6 +69,15 @@ function M.config() | ||||||
|     "templ", |     "templ", | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   -- Servers not supported by mason-lspconfig | ||||||
|  |   local mason_unsupported = { "ccls" } | ||||||
|  | 
 | ||||||
|  |   -- Filter supported servers for mason-lspconfig | ||||||
|  |   local mason_servers = vim.tbl_filter(function(server) | ||||||
|  |     return not vim.tbl_contains(mason_unsupported, server) | ||||||
|  |   end, servers) | ||||||
|  | 
 | ||||||
|  |   -- Tools | ||||||
|   local tools = { |   local tools = { | ||||||
|     "prettierd", |     "prettierd", | ||||||
|     "shfmt", |     "shfmt", | ||||||
|  | @ -104,19 +88,17 @@ function M.config() | ||||||
|     "quick-lint-js", |     "quick-lint-js", | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   local mason_unsupported = { "ccls" } |   -- Mason-LSPconfig setup for automatic installation | ||||||
| 
 |  | ||||||
|   local mason_servers = vim.tbl_filter(function(server) |  | ||||||
|     return not vim.tbl_contains(mason_unsupported, server) |  | ||||||
|   end, servers) |  | ||||||
| 
 |  | ||||||
|   require("mason-lspconfig").setup({ |   require("mason-lspconfig").setup({ | ||||||
|     ensure_installed = mason_servers, |     ensure_installed = mason_servers, | ||||||
|     automatic_installation = true, |     automatic_installation = true, | ||||||
|     automatic_enable = true, |     automatic_enable = true, | ||||||
|   }) |   }) | ||||||
|  | 
 | ||||||
|  |   -- Mason tool installer for tools and ccls | ||||||
|   require("mason-tool-installer").setup({ ensure_installed = tools }) |   require("mason-tool-installer").setup({ ensure_installed = tools }) | ||||||
| 
 | 
 | ||||||
|  |   -- Enable LSP servers | ||||||
|   vim.lsp.enable(servers) |   vim.lsp.enable(servers) | ||||||
| 
 | 
 | ||||||
|   -- LSP Attach |   -- LSP Attach | ||||||
|  | @ -124,27 +106,25 @@ function M.config() | ||||||
|     group = vim.api.nvim_create_augroup("UserLspConfig", { clear = true }), |     group = vim.api.nvim_create_augroup("UserLspConfig", { clear = true }), | ||||||
|     callback = function(args) |     callback = function(args) | ||||||
|       local client = vim.lsp.get_client_by_id(args.data.client_id) |       local client = vim.lsp.get_client_by_id(args.data.client_id) | ||||||
|       if not client then |       local bufnr = args.buf | ||||||
|         return |  | ||||||
|       end |  | ||||||
| 
 | 
 | ||||||
|       setup_keymaps(args.buf) |       setup_keymaps(bufnr) | ||||||
| 
 | 
 | ||||||
|       -- Inlay hints |       -- Inlay hints | ||||||
|       if client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, args.buf) then |       if client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then | ||||||
|         nmap("<leader>th", function() |         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 }) |           vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr })) | ||||||
|         end, { buffer = args.buf, desc = "Toggle Inlay Hints" }) |         end, { buffer = bufnr, desc = "Toggle Inlay Hints" }) | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|       -- Document highlights |       -- Document highlights | ||||||
|       if client.server_capabilities.documentHighlightProvider then |       if client.server_capabilities.documentHighlightProvider then | ||||||
|         vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { |         vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { | ||||||
|           buffer = args.buf, |           buffer = bufnr, | ||||||
|           callback = vim.lsp.buf.document_highlight, |           callback = vim.lsp.buf.document_highlight, | ||||||
|         }) |         }) | ||||||
|         vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { |         vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { | ||||||
|           buffer = args.buf, |           buffer = bufnr, | ||||||
|           callback = vim.lsp.buf.clear_references, |           callback = vim.lsp.buf.clear_references, | ||||||
|         }) |         }) | ||||||
|       end |       end | ||||||
|  |  | ||||||
|  | @ -36,10 +36,6 @@ return { | ||||||
|           border = "rounded", |           border = "rounded", | ||||||
|         }, |         }, | ||||||
|       }, |       }, | ||||||
|       select = { |  | ||||||
|         enabled = true, |  | ||||||
|         win = { 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