From df7c711e2a49d51249350f52c63274b72aacb739 Mon Sep 17 00:00:00 2001 From: Elvis Claros Castro Date: Sun, 27 Sep 2026 12:46:49 -0300 Subject: =?UTF-8?q?Migraci=C3=B3n=20de=20plugins=20a=20funcionalidad=20nat?= =?UTF-8?q?iva:=20statusline=20y=20treesitter=20propios,=20se=20quitan=20m?= =?UTF-8?q?ason,=20lualine,=20mini,=20notify=20y=20otros?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/autocmds.lua | 137 +++++++++++++++++++++- lua/config/init.lua | 3 + lua/config/keymaps.lua | 51 +++++++++ lua/config/lazy.lua | 2 +- lua/config/options.lua | 6 +- lua/config/statusline.lua | 214 ++++++++++++++++++++++++++++++++++ lua/pi/animations.lua | 71 +++++------- lua/pi/dap/configs/cpp.lua | 46 +++++--- lua/pi/lsp/attach.lua | 2 +- lua/pi/lsp/default.lua | 4 - lua/pi/lsp/init.lua | 13 --- lua/pi/lsp/mason.lua | 33 ------ lua/pi/snips/ft/go.lua | 24 ++-- lua/pi/treesitter.lua | 248 ++++++++++++++++++++++++++++++++++++++++ lua/plugins/animation.lua | 11 -- lua/plugins/buffer_manager.lua | 24 ---- lua/plugins/close-buffer.lua | 12 -- lua/plugins/code-annotation.lua | 11 -- lua/plugins/codecompanion.lua | 6 +- lua/plugins/color-picker.lua | 7 -- lua/plugins/colorize.lua | 34 +++--- lua/plugins/completition.lua | 20 ++++ lua/plugins/flutter.lua | 1 - lua/plugins/gitsigns.lua | 11 +- lua/plugins/icon-picker.lua | 9 -- lua/plugins/indent-o-matic.lua | 5 - lua/plugins/init.lua | 11 -- lua/plugins/json-nvim.lua | 8 -- lua/plugins/laravel.lua | 8 +- lua/plugins/lsp.lua | 18 +-- lua/plugins/lualine.lua | 233 ------------------------------------- lua/plugins/menu.lua | 28 ----- lua/plugins/mini.lua | 7 -- lua/plugins/minty.lua | 28 ++++- lua/plugins/navigator.lua | 41 ------- lua/plugins/neorg.lua | 3 +- lua/plugins/neotest.lua | 1 - lua/plugins/noice.lua | 243 +++------------------------------------ lua/plugins/notify.lua | 10 -- lua/plugins/project-config.lua | 5 - lua/plugins/rest.lua | 55 --------- lua/plugins/rustaceanvim.lua | 14 +++ lua/plugins/snacks.lua | 10 ++ lua/plugins/treesitter.lua | 182 +++++++---------------------- lua/plugins/undotree.lua | 11 -- 45 files changed, 907 insertions(+), 1014 deletions(-) create mode 100644 lua/config/statusline.lua delete mode 100644 lua/pi/lsp/mason.lua create mode 100644 lua/pi/treesitter.lua delete mode 100644 lua/plugins/animation.lua delete mode 100644 lua/plugins/buffer_manager.lua delete mode 100644 lua/plugins/close-buffer.lua delete mode 100644 lua/plugins/color-picker.lua delete mode 100644 lua/plugins/icon-picker.lua delete mode 100644 lua/plugins/indent-o-matic.lua delete mode 100644 lua/plugins/json-nvim.lua delete mode 100644 lua/plugins/lualine.lua delete mode 100644 lua/plugins/menu.lua delete mode 100644 lua/plugins/mini.lua delete mode 100644 lua/plugins/navigator.lua delete mode 100644 lua/plugins/notify.lua delete mode 100644 lua/plugins/project-config.lua delete mode 100644 lua/plugins/rest.lua (limited to 'lua') diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index ffb5d57..ccb9bd0 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -15,7 +15,6 @@ vim.api.nvim_create_autocmd("FileType", { "lspinfo", "spectre_panel", "startuptime", - "tsplayground", "PlenaryTestPopup", }, callback = function(event) @@ -162,6 +161,128 @@ vim.api.nvim_create_autocmd("User", { end, }) +-- Progreso LSP como notificación de snacks.notifier (reemplaza noice lsp.progress) +---@type table +local lsp_progress = vim.defaulttable() +vim.api.nvim_create_autocmd("LspProgress", { + group = augroup "lsp_progress_notify", + ---@param ev {data: {client_id: integer, params: lsp.ProgressParams}} + callback = function(ev) + local client = vim.lsp.get_client_by_id(ev.data.client_id) + local value = ev.data.params.value --[[@as {percentage?: number, title?: string, message?: string, kind: "begin" | "report" | "end"}]] + if not client or type(value) ~= "table" then + return + end + local p = lsp_progress[client.id] + + for i = 1, #p + 1 do + if i == #p + 1 or p[i].token == ev.data.params.token then + p[i] = { + token = ev.data.params.token, + msg = ("[%3d%%] %s%s"):format( + value.kind == "end" and 100 or value.percentage or 100, + value.title or "", + value.message and (" **%s**"):format(value.message) or "" + ), + done = value.kind == "end", + } + break + end + end + + local msg = {} ---@type string[] + lsp_progress[client.id] = vim.tbl_filter(function(v) + return table.insert(msg, v.msg) or not v.done + end, p) + + local spinner = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" } + vim.notify(table.concat(msg, "\n"), vim.log.levels.INFO, { + id = "lsp_progress", + title = client.name, + opts = function(notif) + notif.icon = #lsp_progress[client.id] == 0 and " " + or spinner[math.floor(vim.uv.hrtime() / (1e6 * 80)) % #spinner + 1] + end, + }) + end, +}) + +-- Formatear/minificar JSON con jq (reemplaza json-nvim) +vim.api.nvim_create_autocmd("FileType", { + group = augroup "json_jq", + pattern = "json", + callback = function(event) + vim.keymap.set("n", "jff", ":%!jq .", { buffer = event.buf, desc = "Formatear JSON con jq" }) + vim.keymap.set("n", "jmf", ":%!jq -c .", { buffer = event.buf, desc = "Minificar JSON con jq" }) + end, +}) + +-- Cerrar buffers inactivos tras 120 min (reemplaza nvim-early-retirement) +local retirement_age_mins = 120 +local buf_last_used = {} +vim.api.nvim_create_autocmd("BufEnter", { + group = augroup "early_retirement", + callback = function(event) + buf_last_used[event.buf] = os.time() + end, +}) +local retirement_timer = assert(vim.uv.new_timer()) +retirement_timer:start( + 60000, + 60000, + vim.schedule_wrap(function() + local now = os.time() + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + if + vim.api.nvim_buf_is_valid(buf) + and vim.bo[buf].buflisted + and not vim.bo[buf].modified + and #vim.fn.win_findbuf(buf) == 0 + then + local last = buf_last_used[buf] + if last == nil then + buf_last_used[buf] = now + elseif now - last > retirement_age_mins * 60 then + pcall(vim.api.nvim_buf_delete, buf, {}) + buf_last_used[buf] = nil + end + end + end + end) +) + +-- Detección simple de indentación (reemplaza indent-o-matic); editorconfig nativo tiene prioridad +vim.api.nvim_create_autocmd("BufReadPost", { + group = augroup "detect_indent", + callback = function(event) + local ec = vim.b[event.buf].editorconfig + if ec and (ec.indent_style or ec.indent_size) then + return + end + local tabs, spaces, min_spaces = 0, 0, math.huge + for _, line in ipairs(vim.api.nvim_buf_get_lines(event.buf, 0, 200, false)) do + local ws = line:match "^%s+" + if ws then + if ws:find "\t" then + tabs = tabs + 1 + else + spaces = spaces + 1 + if #ws > 1 and #ws < min_spaces then + min_spaces = #ws + end + end + end + end + if tabs > spaces then + vim.bo[event.buf].expandtab = false + elseif spaces > 0 and min_spaces ~= math.huge then + vim.bo[event.buf].expandtab = true + vim.bo[event.buf].shiftwidth = min_spaces + vim.bo[event.buf].softtabstop = min_spaces + end + end, +}) + -- vim.api.nvim_create_autocmd("User", { @@ -177,3 +298,17 @@ vim.api.nvim_create_autocmd("User", { -- end -- end, -- }) + +-- WezTerm no implementa el borrado de imágenes del protocolo kitty (snacks.image +-- usa el modo fallback sin placeholders), así que al salir de un buffer de imagen +-- quedan restos en pantalla. Forzar un repintado completo los limpia. +if vim.env.TERM_PROGRAM == "WezTerm" then + vim.api.nvim_create_autocmd("BufWinLeave", { + group = vim.api.nvim_create_augroup("wezterm_image_cleanup", { clear = true }), + callback = function(ev) + if vim.bo[ev.buf].filetype == "image" then + vim.schedule(function() vim.cmd "mode" end) + end + end, + }) +end diff --git a/lua/config/init.lua b/lua/config/init.lua index 5da196b..fe60f1f 100644 --- a/lua/config/init.lua +++ b/lua/config/init.lua @@ -7,6 +7,9 @@ require "config.options" local colorscheme = require "config.native-colorscheme" colorscheme.setup() +-- Statusline nativa (reemplaza lualine.nvim) +require("config.statusline").setup() + -- Additional UI Enhancements vim.opt.guicursor = "n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50" vim.opt.cursorline = true diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index c1e126e..00ef762 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -173,3 +173,54 @@ map("n", "ft", "FloatermToggle", { desc = "run terminal" }) map({ "n", "v" }, "", "CodeCompanionActions", { noremap = true, silent = true }) map({ "n", "v" }, "a", "CodeCompanionChat Toggle", { noremap = true, silent = true }) map("v", "ga", "CodeCompanionChat Add", { noremap = true, silent = true }) + +-- Historial de notificaciones (reemplaza :Noice history) +map("n", "nh", function() + Snacks.notifier.show_history() +end, { desc = "Historial de notificaciones" }) + +-- Abrir archivo/selección en el navegador (reemplaza vim-rhubarb :GBrowse) +map({ "n", "v" }, "go", function() + Snacks.gitbrowse() +end, { desc = "Git browse en el navegador" }) + +-- Picker de iconos/emoji (reemplaza icon-picker.nvim) +map("n", "i", function() + Snacks.picker.icons() +end, { desc = "Insertar icono/emoji" }) +map("n", "y", function() + Snacks.picker.icons { confirm = "yank" } +end, { desc = "Copiar icono/emoji" }) +map("i", "", function() + Snacks.picker.icons() +end, { desc = "Insertar icono/emoji" }) + +-- Menú de acciones de Oil vía vim.ui.select (reemplaza menu.nvim) +map("n", "um", function() + local items = vim.tbl_filter(function(item) + return item.cmd ~= nil + end, require "menus.oil") + vim.ui.select(items, { + prompt = "Oil", + format_item = function(item) + return item.name .. (item.rtxt and " (" .. item.rtxt .. ")" or "") + end, + }, function(choice) + if choice then + choice.cmd() + end + end) +end, { desc = "Abrir menú de Oil" }) + +-- Animación de retipeo del buffer (antes plugin animation.nvim) +map("n", "AA", function() + require("pi.animations").redraw_buffer() +end, { desc = "Retype buffer animation" }) + +-- Buffers abiertos y navegación entre ellos (reemplaza buffer_manager.nvim, +-- roto en Neovim: usa el autocmd BufModifiedSet, que Vim soporta pero Neovim no implementa) +map("n", "o", function() + Snacks.picker.buffers() +end, { desc = "Buffers abiertos" }) +map("n", "]b", ":bnext", { desc = "Buffer siguiente" }) +map("n", "[b", ":bprevious", { desc = "Buffer anterior" }) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 34e034f..89a14a8 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -13,7 +13,7 @@ vim.opt.rtp:prepend(lazypath) require("lazy").setup { -- leave nil when passing the spec as the first argument to setup() - spec = { { "LazyVim/LazyVim", import = "plugins" } }, + spec = { { import = "plugins" } }, local_spec = true, -- load project specific .lazy.lua spec files. They will be added at the end of the spec. defaults = { -- Set this to `true` to have all your plugins lazy-loaded by default. diff --git a/lua/config/options.lua b/lua/config/options.lua index 2d80d08..1598c1c 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -103,8 +103,10 @@ opt.listchars = "tab:\\ ,trail:-" -- Siempre muestra la línea de estado. opt.laststatus = 3 --- Configura la altura del área de comandos. -opt.cmdheight = 1 +-- Sin fila de comandos: la cmdline la dibuja noice como popup centrado. +-- (Antes lo forzaba noice con messages activado; ahora lo seteamos nosotros.) +-- En firenvim no hay noice, así que ahí se mantiene la fila clásica. +opt.cmdheight = vim.g.started_by_firenvim and 1 or 0 -- Establece el tiempo de actualización en milisegundos. opt.updatetime = 50 diff --git a/lua/config/statusline.lua b/lua/config/statusline.lua new file mode 100644 index 0000000..c74d8d4 --- /dev/null +++ b/lua/config/statusline.lua @@ -0,0 +1,214 @@ +-- Statusline nativa (reemplaza lualine.nvim), con la paleta de config.native-colorscheme. +local M = {} + +local colors = require("config.native-colorscheme").colors + +local mode_names = { + n = "NORMAL", + no = "O-PENDING", + nt = "NORMAL", + v = "VISUAL", + V = "V-LINE", + ["\22"] = "V-BLOCK", + s = "SELECT", + S = "S-LINE", + ["\19"] = "S-BLOCK", + i = "INSERT", + R = "REPLACE", + Rv = "V-REPLACE", + c = "COMMAND", + cv = "EX", + r = "PROMPT", + ["r?"] = "CONFIRM", + ["!"] = "SHELL", + t = "TERMINAL", +} + +local mode_hl = { + n = "StlModeNormal", + i = "StlModeInsert", + v = "StlModeVisual", + V = "StlModeVisual", + ["\22"] = "StlModeVisual", + s = "StlModeVisual", + S = "StlModeVisual", + c = "StlModeCommand", + R = "StlModeReplace", + r = "StlModeReplace", + t = "StlModeTerminal", + ["!"] = "StlModeTerminal", +} + +function M.set_highlights() + local hl = function(name, fg, bg, bold) + vim.api.nvim_set_hl(0, name, { fg = fg, bg = bg, bold = bold ~= false }) + end + hl("StlModeIcon", colors.base4, colors.base03) + hl("StlModeNormal", colors.blue100, colors.base03) + hl("StlModeInsert", colors.green100, colors.base03) + hl("StlModeVisual", colors.magenta100, colors.base03) + hl("StlModeCommand", colors.yellow100, colors.base03) + hl("StlModeReplace", colors.red100, colors.base03) + hl("StlModeTerminal", colors.orange100, colors.base03) + hl("StlBranch", colors.orange100, colors.base03) + hl("StlDiffAdd", colors.green300, colors.base03) + hl("StlDiffChange", colors.yellow300, colors.base03) + hl("StlDiffDelete", colors.red300, colors.base03) + hl("StlFile", colors.yellow100, colors.base03) + hl("StlDiagError", colors.red300, colors.base03) + hl("StlDiagWarn", colors.yellow300, colors.base03) + hl("StlDiagInfo", colors.blue300, colors.base03) + hl("StlDiagHint", colors.cyan300, colors.base03) + hl("StlUpdates", colors.orange300, colors.bg_statusline, false) + hl("StlLsp", colors.base4, colors.base03) + hl("StlFt", colors.magenta100, colors.base03) + hl("StlProgress", colors.cyan100, colors.base03) + hl("StlSep", colors.base00, colors.base03, false) + hl("StlBg", colors.fg, colors.bg_statusline, false) +end + +-- Handlers de click (:h 'statusline' %@); globales porque %@ necesita un nombre simple. +function _G.StlClickFile() + Snacks.picker.files() +end + +function _G.StlClickDiag() + Snacks.picker.diagnostics() +end + +local function filename() + local name = vim.api.nvim_buf_get_name(0) + if name == "" then + return "[Sin nombre]" + end + local file = vim.fn.fnamemodify(name, ":t") + local parent = vim.fn.fnamemodify(name, ":h:t") + return parent .. "/" .. file +end + +local function git() + local out = {} + -- vim.b para el repo del buffer; vim.g como fallback (repo del cwd, ej. en oil) + local head = vim.b.gitsigns_head or vim.g.gitsigns_head + if head and head ~= "" then + out[#out + 1] = "%#StlBranch# " .. head + end + local status = vim.b.gitsigns_status_dict + if status then + if (status.added or 0) > 0 then + out[#out + 1] = "%#StlDiffAdd# " .. status.added + end + if (status.changed or 0) > 0 then + out[#out + 1] = "%#StlDiffChange# " .. status.changed + end + if (status.removed or 0) > 0 then + out[#out + 1] = "%#StlDiffDelete# " .. status.removed + end + end + if #out == 0 then + return "" + end + return table.concat(out) +end + +local diag_specs = { + { vim.diagnostic.severity.ERROR, "StlDiagError", " " }, + { vim.diagnostic.severity.WARN, "StlDiagWarn", " " }, + { vim.diagnostic.severity.INFO, "StlDiagInfo", " " }, + { vim.diagnostic.severity.HINT, "StlDiagHint", "󰠠 " }, +} + +local function diagnostics() + local counts = vim.diagnostic.count(0) + local parts = {} + for _, spec in ipairs(diag_specs) do + local n = counts[spec[1]] + if n and n > 0 then + parts[#parts + 1] = "%#" .. spec[2] .. "#" .. spec[3] .. n + end + end + if #parts == 0 then + return "" + end + return "%@v:lua.StlClickDiag@" .. table.concat(parts, " ") .. "%X " +end + +local function lsp_clients() + local clients = vim.lsp.get_clients { bufnr = 0 } + if #clients == 0 then + return "No LSP" + end + local names = {} + for _, client in ipairs(clients) do + names[#names + 1] = client.name + end + return table.concat(names, ",") +end + +local function lazy_updates() + local ok, status = pcall(require, "lazy.status") + if ok and status.has_updates() then + return "%#StlUpdates#" .. status.updates() .. " " + end + return "" +end + +local function filetype() + local ft = vim.bo.filetype + if ft == "" then + return "" + end + local ok, mini = pcall(require, "mini.icons") + if ok then + local ok_get, icon, icon_hl = pcall(mini.get, "filetype", ft) + if ok_get and icon then + return "%#" .. icon_hl .. "#" .. icon .. " %#StlFt#" .. ft .. " " + end + end + return "%#StlFt#" .. ft .. " " +end + +-- Como el componente 'progress' de lualine: Top / Bot / porcentaje +local function progress() + local cur = vim.fn.line "." + local total = vim.fn.line "$" + if cur == 1 then + return "Top" + elseif cur == total then + return "Bot" + end + return string.format("%2d%%%%", math.floor(cur / total * 100)) +end + +function M.render() + local mode = vim.api.nvim_get_mode().mode + local hl = mode_hl[mode:sub(1, 1)] or "StlModeNormal" + local name = mode_names[mode] or mode_names[mode:sub(1, 1)] or mode + local left = vim.tbl_filter(function(s) + return s ~= "" + end, { + "%#StlModeIcon# %#" .. hl .. "#" .. name, + git(), + "%#StlFile#%@v:lua.StlClickFile@ " .. filename() .. "%X", + }) + + return table.concat(left, "%#StlSep# │ ") .. table.concat { + " %#StlBg#%=", + diagnostics(), + lazy_updates(), + "%#StlLsp#", lsp_clients(), " ", + filetype(), + "%#StlProgress#", progress(), " ", + } +end + +function M.setup() + M.set_highlights() + vim.api.nvim_create_autocmd("ColorScheme", { + group = vim.api.nvim_create_augroup("native_statusline", { clear = true }), + callback = M.set_highlights, + }) + vim.o.statusline = "%!v:lua.require'config.statusline'.render()" +end + +return M diff --git a/lua/pi/animations.lua b/lua/pi/animations.lua index 3ff711f..e4bc859 100644 --- a/lua/pi/animations.lua +++ b/lua/pi/animations.lua @@ -1,48 +1,39 @@ -local redraw_buffer = function() - local Animation = require "animation" - local fps = 15 -- frames per second - local easing = require "animation.easing" - - local buffer = 0 - local len = 0 - local place_holder = {} +-- Animación de "retipeo" del buffer, con vim.uv (antes dependía de animation.nvim). +local fps = 15 -- un caracter por frame, como la versión original +local redraw_buffer = function() + local buffer = vim.api.nvim_get_current_buf() local lines = vim.api.nvim_buf_get_lines(buffer, 0, -1, true) - for _, line in ipairs(lines) do - len = len + string.len(line) + local place_holder = {} + for _ = 1, #lines do table.insert(place_holder, "") end - - vim.api.nvim_buf_set_lines(buffer, 0, #lines, true, place_holder) - - local duration = math.ceil(len / fps * 1000) - - local i = 1 - local line_nr = 1 - local insertLine = "" - - local function callback() - if lines[line_nr] == nil then - return true - end - local char = string.sub(lines[line_nr], i, i) - if char == nil then - return true - end - insertLine = insertLine .. char - i = i + 1 - vim.api.nvim_buf_set_lines(buffer, line_nr - 1, line_nr, true, { insertLine }) - - if insertLine == lines[line_nr] then - i = 1 - line_nr = line_nr + 1 - insertLine = "" - end - end - - local animation = Animation(duration, fps, easing.line, callback) - animation:run() + vim.api.nvim_buf_set_lines(buffer, 0, -1, true, place_holder) + + local line_nr, col = 1, 0 + local timer = assert(vim.uv.new_timer()) + + timer:start( + 0, + math.floor(1000 / fps), + vim.schedule_wrap(function() + if not vim.api.nvim_buf_is_valid(buffer) or line_nr > #lines then + timer:stop() + timer:close() + return + end + + col = col + 1 + local line = lines[line_nr] + vim.api.nvim_buf_set_lines(buffer, line_nr - 1, line_nr, true, { line:sub(1, col) }) + + if col >= #line then + line_nr = line_nr + 1 + col = 0 + end + end) + ) end return { diff --git a/lua/pi/dap/configs/cpp.lua b/lua/pi/dap/configs/cpp.lua index a2718b0..4f47345 100644 --- a/lua/pi/dap/configs/cpp.lua +++ b/lua/pi/dap/configs/cpp.lua @@ -1,24 +1,47 @@ local dap = require("dap") +-- gdb DAP nativo (gdb >= 14). No usa runInTerminal, así que evita el bug +-- de nvim-dap `terminals.acquire` en Neovim 0.13-dev. La salida del programa +-- aparece en la consola/repl de dap-ui. +dap.adapters.gdb = { + type = "executable", + command = "gdb", + args = { "--interpreter=dap", "--eval-command", "set print pretty on" }, +} + +-- Adaptador cpptools/OpenDebugAD7 (Microsoft) como fallback. dap.adapters.cppdbg = { id = 'cppdbg', type = 'executable', command = '/home/elvis/.local/share/nvim/mason/packages/cpptools/extension/debugAdapters/bin/OpenDebugAD7', } +local function pick_program() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') +end + +local function pick_args() + return vim.split(vim.fn.input('Program arguments: ', ''), " ") +end + dap.configurations.cpp = { { - name = "Launch file", + name = "Launch (gdb)", + type = "gdb", + request = "launch", + program = pick_program, + cwd = "${workspaceFolder}", + args = pick_args, + stopAtBeginningOfMainSubprogram = true, -- equivalente a stopAtEntry en gdb DAP + }, + { + name = "Launch (cppdbg / cpptools)", type = "cppdbg", request = "launch", - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, + program = pick_program, cwd = '${workspaceFolder}', stopAtEntry = true, - args = function() - return vim.split(vim.fn.input('Program arguments: ', ''), " ") - end, + args = pick_args, }, { name = 'Attach to gdbserver :1234', @@ -28,14 +51,9 @@ dap.configurations.cpp = { miDebuggerServerAddress = 'localhost:1234', miDebuggerPath = '/usr/bin/gdb', cwd = '${workspaceFolder}', - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - args = function() - return vim.split(vim.fn.input('Program arguments: ', ''), " ") - end, + program = pick_program, + args = pick_args, }, } dap.configurations.c = dap.configurations.cpp - diff --git a/lua/pi/lsp/attach.lua b/lua/pi/lsp/attach.lua index 7030cbd..e05f3f3 100644 --- a/lua/pi/lsp/attach.lua +++ b/lua/pi/lsp/attach.lua @@ -23,7 +23,7 @@ return function(client, bufnr) vim.keymap.set("n", "gr", function() Snacks.picker.lsp_references() end, { buffer = bufnr, desc = "LSP References of symbol on cursor" }) vim.keymap.set("n", "pv", function() Snacks.picker.lsp_workspace_symbols() end, { buffer = bufnr, desc = "LSP find symbol on the project" }) vim.keymap.set("n", "pd", function() Snacks.picker.lsp_symbols() end, { buffer = bufnr, desc = "LSP document symbols" }) - vim.keymap.set("n", "", function() Snacks.picker.lsp_definitions() end, { buffer = bufnr, desc = "LSP go to definition" }) + vim.keymap.set("n", "gd", function() Snacks.picker.lsp_definitions() end, { buffer = bufnr, desc = "LSP go to definition" }) vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc" diff --git a/lua/pi/lsp/default.lua b/lua/pi/lsp/default.lua index efde87a..1f4dfb0 100644 --- a/lua/pi/lsp/default.lua +++ b/lua/pi/lsp/default.lua @@ -35,10 +35,6 @@ local server_commands = { } return { - mason = { - enable = true, - auto_install = false, - }, get_server_cmd = function(server) return server_commands[server] or { server } end, diff --git a/lua/pi/lsp/init.lua b/lua/pi/lsp/init.lua index de6e95b..ebc8fab 100644 --- a/lua/pi/lsp/init.lua +++ b/lua/pi/lsp/init.lua @@ -10,7 +10,6 @@ return { return orig_open_floating_preview(contents, syntax, opts, ...) end - local mason_servers = {} for server, options in pairs(ops.servers) do if options.enable == true then local ok, definition = pcall(require, "pi.lsp.servers." .. server) @@ -53,19 +52,7 @@ return { end, }) end - - table.insert(mason_servers, server) - end - end - - -- Mason - if ops.mason.enable then - local mason_ops = {} - if ops.mason.auto_install == true then - mason_ops.ensure_installed = mason_servers end - local mason_lspconfig = require "mason-lspconfig" - mason_lspconfig.setup(mason_ops) end -- TODO: implement null ls with options diff --git a/lua/pi/lsp/mason.lua b/lua/pi/lsp/mason.lua deleted file mode 100644 index 6c959a6..0000000 --- a/lua/pi/lsp/mason.lua +++ /dev/null @@ -1,33 +0,0 @@ -local mason_lspconfig = require "mason-lspconfig" -local servers = require "pi.lsp.servers" - --- Note: This file is deprecated in favor of native LSP configuration --- Keeping for reference/compatibility - -local mason_servers = {} - --- Since we're using native LSP, we'll check for executables differently -local server_commands = { - lua_ls = "lua-language-server", - gopls = "gopls", - ts_ls = "typescript-language-server", - -- Add other servers as needed -} - -for server, _ in pairs(servers) do - local cmd = server_commands[server] or server - if vim.fn.executable(cmd) == 0 then - table.insert(mason_servers, server) - end -end - -mason_lspconfig.setup { - -- ensure_installed = mason_servers, -} - --- filter the list for the ones not globally installed --- require("mason-tool-installer").setup { --- ensure_installed = vim.tbl_filter(function (tool) --- return vim.fn.executable(tool) == 0 --- end, require "pi.lsp.tools"), --- } diff --git a/lua/pi/snips/ft/go.lua b/lua/pi/snips/ft/go.lua index 9c3977f..4490e63 100644 --- a/lua/pi/snips/ft/go.lua +++ b/lua/pi/snips/ft/go.lua @@ -8,9 +8,6 @@ local i = ls.insert_node local rep = require("luasnip.extras").rep local fmt = require("luasnip.extras.fmt").fmt -local ts_locals = require "nvim-treesitter.locals" -local ts_utils = require "nvim-treesitter.ts_utils" - local get_node_text = vim.treesitter.get_node_text vim.treesitter.query.set( @@ -71,19 +68,28 @@ local handlers = { end, } +-- `nvim-treesitter.locals`/`ts_utils` no existen en la rama `main`; subimos a +-- mano por los padres del nodo bajo el cursor hasta la función que lo contiene. local function go_result_type(info) - local cursor_node = ts_utils.get_node_at_cursor() - local scope = ts_locals.get_scope_tree(cursor_node, 0) - local function_node - for _, v in ipairs(scope) do - if v:type() == "function_declaration" or v:type() == "method_declaration" or v:type() == "func_literal" then - function_node = v + local node = vim.treesitter.get_node() + while node do + local kind = node:type() + if kind == "function_declaration" or kind == "method_declaration" or kind == "func_literal" then + function_node = node break end + node = node:parent() + end + + if not function_node then + return end local query = vim.treesitter.query.get("go", "LuaSnip_Result") + if not query then + return + end for _, node in query:iter_captures(function_node, 0) do if handlers[node:type()] then return handlers[node:type()](node, info) diff --git a/lua/pi/treesitter.lua b/lua/pi/treesitter.lua new file mode 100644 index 0000000..d137ac5 --- /dev/null +++ b/lua/pi/treesitter.lua @@ -0,0 +1,248 @@ +-- Integración de treesitter para Neovim 0.13 + nvim-treesitter rama `main`. +-- +-- La rama `main` es una reescritura sin sistema de módulos: sólo instala parsers +-- y provee queries. Highlight, indent, folds e injections los da Neovim, así que +-- el enganche lo hacemos nosotros en un autocomando FileType. + +local M = {} + +local install_dir = vim.fs.joinpath(vim.fn.stdpath "data", "site") + +--- Parsers que queremos siempre disponibles. +M.ensure_installed = { + "bash", + "blade", + "css", + "dockerfile", + "cpp", + "elixir", + "erlang", + "go", + "gomod", + "html", + "javascript", + "json", + "latex", + "lua", + "luadoc", + "markdown", + "markdown_inline", + "nix", + "php", + "php_only", + "phpdoc", + "python", + "query", + "regex", + "rust", + "sql", + "svelte", + "twig", + "typescript", + "typst", + "vim", + "yaml", +} + +--- Filetypes de buffers de plugins que reusan el parser de otro lenguaje. +M.language_aliases = { + codecompanion = "markdown", + snacks_notif = "markdown", + oil = "markdown", +} + +--- Filetypes donde no queremos highlight ni indent de treesitter. +M.disabled_filetypes = { + oil = true, + snacks_notif = true, +} + +---@param lang string +---@return boolean +local function parser_available(lang) + return #vim.api.nvim_get_runtime_file("parser/" .. lang .. ".so", false) > 0 +end + +--- Reemplazo de `auto_install`: instala el parser que falte, una sola vez por +--- lenguaje y sin bloquear, y engancha el buffer cuando termina. +local installing = {} ---@type table + +---@param lang string +---@param on_ready fun() +local function install_missing(lang, on_ready) + if installing[lang] then + return + end + local ok, parsers = pcall(require, "nvim-treesitter.parsers") + if not ok or not parsers[lang] then + return + end + installing[lang] = true + require("nvim-treesitter").install({ lang }):await(function() + installing[lang] = nil + vim.schedule(on_ready) + end) +end + +---@param buf integer +local function attach(buf) + if not vim.api.nvim_buf_is_valid(buf) then + return + end + + local ft = vim.bo[buf].filetype + if ft == "" or M.disabled_filetypes[ft] then + return + end + + local lang = vim.treesitter.language.get_lang(ft) + if not lang then + return + end + + if not parser_available(lang) then + install_missing(lang, function() + attach(buf) + end) + return + end + + if not pcall(vim.treesitter.start, buf, lang) then + return + end + + -- Indent de nvim-treesitter (experimental, era el módulo `indent` en master). + -- Sólo si el lenguaje trae query `indents`; si no, dejamos el indentexpr del + -- ftplugin, que es mejor que un fallback vacío. + if vim.treesitter.query.get(lang, "indents") then + vim.bo[buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end +end + +function M.setup() + require("nvim-treesitter").setup { install_dir = install_dir } + + for ft, lang in pairs(M.language_aliases) do + vim.treesitter.language.register(lang, ft) + end + + vim.filetype.add { + pattern = { + [".*%.blade%.php"] = "blade", + }, + } + + require("nvim-treesitter").install(M.ensure_installed) + + vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("pi_treesitter", { clear = true }), + callback = function(args) + attach(args.buf) + end, + }) + + -- El autocomando llega tarde para los buffers que ya se abrieron al arrancar. + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + if vim.api.nvim_buf_is_loaded(buf) then + attach(buf) + end + end + + M.setup_incremental_selection() +end + +-------------------------------------------------------------------------------- +-- Selección incremental +-- +-- El módulo `incremental_selection` desapareció con la rama `main` y Neovim no +-- trae equivalente. Esto reimplementa los cuatro mapeos que había: gnn / grn / +-- grc / grm. +-------------------------------------------------------------------------------- + +local stacks = {} ---@type table + +---@param node TSNode +local function select_node(node) + local srow, scol, erow, ecol = node:range() + if ecol == 0 and erow > srow then + erow = erow - 1 + ecol = #(vim.api.nvim_buf_get_lines(0, erow, erow + 1, false)[1] or "") + end + if vim.fn.mode() ~= "n" then + vim.cmd "normal! \27" + end + vim.fn.setpos("'<", { 0, srow + 1, scol + 1, 0 }) + vim.fn.setpos("'>", { 0, erow + 1, math.max(ecol, 1), 0 }) + vim.cmd "normal! gv" +end + +---@return TSNode[] +local function stack() + local buf = vim.api.nvim_get_current_buf() + stacks[buf] = stacks[buf] or {} + return stacks[buf] +end + +local function init_selection() + local node = vim.treesitter.get_node() + if not node then + return + end + local s = stack() + for i = #s, 1, -1 do + s[i] = nil + end + s[1] = node + select_node(node) +end + +--- Sube al ancestro más chico que sea estrictamente más grande que el actual. +---@param predicate? fun(node: TSNode, from: TSNode): boolean +local function grow(predicate) + local s = stack() + local node = s[#s] or vim.treesitter.get_node() + if not node then + return + end + local parent = node:parent() + while parent do + local same = vim.deep_equal({ parent:range() }, { node:range() }) + if not same and (not predicate or predicate(parent, node)) then + s[#s + 1] = parent + select_node(parent) + return + end + parent = parent:parent() + end + select_node(node) +end + +local function shrink() + local s = stack() + if #s > 1 then + s[#s] = nil + end + local node = s[#s] + if node then + select_node(node) + end +end + +function M.setup_incremental_selection() + local map = vim.keymap.set + map("n", "gnn", init_selection, { desc = "Treesitter: iniciar selección" }) + map("x", "grn", function() + grow() + end, { desc = "Treesitter: expandir al nodo padre" }) + map("x", "grc", function() + -- "scope": el primer ancestro que abarque más líneas que el nodo actual. + grow(function(parent, from) + local psrow, _, perow = parent:range() + local srow, _, erow = from:range() + return (perow - psrow) > (erow - srow) + end) + end, { desc = "Treesitter: expandir al scope" }) + map("x", "grm", shrink, { desc = "Treesitter: reducir selección" }) +end + +return M diff --git a/lua/plugins/animation.lua b/lua/plugins/animation.lua deleted file mode 100644 index 865287e..0000000 --- a/lua/plugins/animation.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - "anuvyklack/animation.nvim", - dependencies = { - "anuvyklack/middleclass", - }, - keys = { - {"AA", function () - require("pi.animations").redraw_buffer() - end} - }, -} diff --git a/lua/plugins/buffer_manager.lua b/lua/plugins/buffer_manager.lua deleted file mode 100644 index 794e178..0000000 --- a/lua/plugins/buffer_manager.lua +++ /dev/null @@ -1,24 +0,0 @@ -return { - 'j-morano/buffer_manager.nvim', - dependencies = { 'nvim-lua/plenary.nvim' }, - keys = { - { - desc = 'Buffer Manager', - 'o', - function() require('buffer_manager.ui').toggle_quick_menu() end, - }, - { - desc = 'Next buffer', - ']b', - function() require('buffer_manager.ui').nav_next() end, - }, - { - desc = 'Previous buffer', - '[b', - function() require('buffer_manager.ui').nav_prev() end, - }, - }, - opts = { - width = 0.9, - }, - } diff --git a/lua/plugins/close-buffer.lua b/lua/plugins/close-buffer.lua deleted file mode 100644 index 64a6a82..0000000 --- a/lua/plugins/close-buffer.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - -- Send buffers into early retirement by automatically closing them after x minutes of inactivity. - { - "chrisgrieser/nvim-early-retirement", - config = true, - event = "VeryLazy", - opts = { - -- if a buffer has been inactive for this many minutes, close it - retirementAgeMins = 120, - }, - }, -} diff --git a/lua/plugins/code-annotation.lua b/lua/plugins/code-annotation.lua index eae61d0..52d0379 100644 --- a/lua/plugins/code-annotation.lua +++ b/lua/plugins/code-annotation.lua @@ -9,17 +9,6 @@ if not vim.g.vscode then end return { - -- JsDoc generator - { - "heavenshell/vim-jsdoc", - ft = "javascript,typescript,typescriptreact,svelte", - cmd = "JsDoc", - keys = { - { "jd", "JsDoc", desc = "JsDoc" }, - }, - -- make sure that you will have lehre install locally on plugin folder, refer https://github.com/heavenshell/vim-jsdoc#manual-installation - build = "make install", - }, { -- A better annotation generator. Supports multiple languages and annotation conventions. -- to jump to next annotation, to jump to previous annotation diff --git a/lua/plugins/codecompanion.lua b/lua/plugins/codecompanion.lua index 7b805a7..f4230b0 100644 --- a/lua/plugins/codecompanion.lua +++ b/lua/plugins/codecompanion.lua @@ -216,36 +216,36 @@ return { -- }, }, inline = { + -- adapter = "llama.cpp", adapter = { name ="claude_code", model = "claude-haiku-4-5", -- model = "claude-sonnet-4-6", }, - -- adapter = "llama.cpp", -- adapter = { -- name = "copilot", -- model = "gpt-4.1", -- }, }, cmd = { + -- adapter = "llama.cpp", adapter = { name ="claude_code", model = "claude-haiku-4-5", -- model = "claude-sonnet-4-6", }, - -- adapter = "llama.cpp", -- adapter = { -- name = "copilot", -- model = "gpt-4.1", -- }, }, background = { + -- adapter = "llama.cpp" adapter = { name ="claude_code", model = "claude-haiku-4-5", -- model = "claude-sonnet-4-6", }, - -- adapter = "llama.cpp" -- adapter = { -- name = "copilot", -- model = "gpt-4.1", diff --git a/lua/plugins/color-picker.lua b/lua/plugins/color-picker.lua deleted file mode 100644 index 1e6c88b..0000000 --- a/lua/plugins/color-picker.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - "ziontee113/color-picker.nvim", - keys = { - { "", "PickColorInsert", mode = "i", desc = "ColorPicker" }, - }, - config = true, -} diff --git a/lua/plugins/colorize.lua b/lua/plugins/colorize.lua index 41a4006..9f4dcef 100644 --- a/lua/plugins/colorize.lua +++ b/lua/plugins/colorize.lua @@ -1,19 +1,23 @@ return { - 'norcalli/nvim-colorizer.lua', - config = function() - require('colorizer').setup({ - 'css', - 'lua', - }, { + -- Fork mantenido de norcalli/nvim-colorizer.lua (el original usa APIs deprecadas + -- y dejaba el aviso "vim.tbl_flatten is deprecated" en cada arranque) + 'catgoose/nvim-colorizer.lua', + event = 'BufReadPre', + opts = { + filetypes = { + 'css', 'scss', 'sass', 'less', 'html', + 'lua', 'javascript', 'typescript', + 'toml', 'conf', 'yaml', 'json', + }, + user_default_options = { RGB = true, -- Colorear valores RGB - RRGGBB = true, -- Deshabilitar otros formatos + RRGGBB = true, names = false, -- Deshabilitar nombres de colores como "Red" - RRGGBBAA = true, -- Deshabilitar valores RGBA - rgb_fn = true, -- Deshabilitar funciones rgb() y rgba() - hsl_fn = true, -- Deshabilitar funciones hsl() y hsla() - css = false, -- Deshabilitar otros valores CSS - css_fn = false, -- Deshabilitar funciones CSS - }) - end + RRGGBBAA = true, + rgb_fn = true, -- Funciones rgb() y rgba() + hsl_fn = true, -- Funciones hsl() y hsla() + css = false, + css_fn = false, + }, + }, } - diff --git a/lua/plugins/completition.lua b/lua/plugins/completition.lua index 071c16c..bde2568 100644 --- a/lua/plugins/completition.lua +++ b/lua/plugins/completition.lua @@ -155,6 +155,26 @@ return { -- Experimental signature help support signature = { enabled = true }, + cmdline = { + enabled = true, + keymap = { + [""] = { "select_next", "fallback" }, + [""] = { "select_prev", "fallback" }, + [""] = { "accept", "fallback" }, + [""] = { "cancel", "fallback" }, + }, + completion = { + list = { selection = { preselect = false, auto_insert = false } }, + menu = { auto_show = true }, + }, + sources = function() + local type = vim.fn.getcmdtype() + if type == "/" or type == "?" then return { "buffer" } end + if type == ":" or type == "@" then return { "cmdline" } end + return {} + end, + }, + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance fuzzy = { implementation = "prefer_rust_with_warning" }, }, diff --git a/lua/plugins/flutter.lua b/lua/plugins/flutter.lua index 9d83940..36f2101 100644 --- a/lua/plugins/flutter.lua +++ b/lua/plugins/flutter.lua @@ -5,7 +5,6 @@ return filetype = 'dart', dependencies = { 'nvim-lua/plenary.nvim', - 'stevearc/dressing.nvim', -- optional for vim.ui.select }, config = true, } diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua index 251ab40..6dd6145 100644 --- a/lua/plugins/gitsigns.lua +++ b/lua/plugins/gitsigns.lua @@ -4,7 +4,14 @@ return { opts = { signcolumn = false, numhl = true, - trouble = false, + current_line_blame = false, -- arranca apagado; se activa con el toggle + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 300, + ignore_whitespace = false, + }, + current_line_blame_formatter = " , · ", on_attach = function(bufnr) local gitsigns = require "gitsigns" vim.keymap.set("n", "hs", gitsigns.stage_hunk, { buffer = bufnr }) @@ -13,6 +20,8 @@ return { vim.keymap.set("n", "hp", gitsigns.preview_hunk, { buffer = bufnr }) vim.keymap.set("n", "hj", gitsigns.next_hunk, { buffer = bufnr }) vim.keymap.set("n", "hk", gitsigns.prev_hunk, { buffer = bufnr }) + -- Toggle del blame virtual (autor que modificó la línea) + vim.keymap.set("n", "hb", gitsigns.toggle_current_line_blame, { buffer = bufnr, desc = "Toggle blame línea" }) end, max_file_length = 10000, }, diff --git a/lua/plugins/icon-picker.lua b/lua/plugins/icon-picker.lua deleted file mode 100644 index adb1bb4..0000000 --- a/lua/plugins/icon-picker.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - "ziontee113/icon-picker.nvim", - keys = { - { "i", "IconPickerNormal nerd_font", mode = "n", desc = "IconPicker NerdFont Insert" }, - { "y", "IconPickerYank nerd_font", mode = "n", desc = "IconPicker NerdFont Yank" }, - { "", "IconPickerInsert nerd_font emoji alt_font nerd_font_v3 symbols ", mode = "i", desc = "IconPicker NerdFont Insert mode" }, - }, - opts = { disable_legacy_commands = true }, -} diff --git a/lua/plugins/indent-o-matic.lua b/lua/plugins/indent-o-matic.lua deleted file mode 100644 index 39b53d3..0000000 --- a/lua/plugins/indent-o-matic.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - 'Darazaki/indent-o-matic', - event = 'BufReadPre', - opts = {}, - } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 3df2c55..dc3715b 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,15 +1,4 @@ return { - { - "jwalton512/vim-blade", - enabled = false, - }, - { - "tpope/vim-dispatch", - cmd = { "Make", "Dispatch" }, - }, "tpope/vim-surround", "tpope/vim-repeat", - "tpope/vim-rhubarb", - "tpope/vim-dotenv", - "tpope/vim-eunuch", } diff --git a/lua/plugins/json-nvim.lua b/lua/plugins/json-nvim.lua deleted file mode 100644 index 3866e1b..0000000 --- a/lua/plugins/json-nvim.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "VPavliashvili/json-nvim", - ft = "json", -- only load for json filetype - config = function() - vim.keymap.set("n", "jff", "JsonFormatFile") - vim.keymap.set("n", "jmf", "JsonMinifyFile") - end, -} diff --git a/lua/plugins/laravel.lua b/lua/plugins/laravel.lua index b158221..e524698 100644 --- a/lua/plugins/laravel.lua +++ b/lua/plugins/laravel.lua @@ -1,8 +1,6 @@ return { "adalessa/laravel.nvim", dependencies = { - "rcarriga/nvim-notify", - "nvim-telescope/telescope.nvim", "MunifTanjim/nui.nvim", }, cmd = { "Sail", "Artisan", "Composer", "Npm", "Laravel", "LaravelInfo", "DockerCompose" }, @@ -28,6 +26,11 @@ return { local user_arg = string.format("%s:%s", vim.trim(uid), vim.trim(gid)) require("laravel").setup { + features = { + pickers = { + provider = "snacks", + }, + }, route_info = { position = "top", }, @@ -40,6 +43,5 @@ return { }, }, } - require("telescope").load_extension "laravel" end, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 57e1b09..4448b91 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -13,27 +13,11 @@ return { }, event = "VeryLazy", }, - { - "williamboman/mason-lspconfig.nvim", - event = "VeryLazy", - dependencies = { - "neovim/nvim-lspconfig", - }, - }, - { - "WhoIsSethDaniel/mason-tool-installer.nvim", - event = "VeryLazy", - }, { name = "native-lsp", dir = vim.fn.stdpath("config"), event = "VeryLazy", main = "pi.lsp", - opts = { - mason = { - enable = true, - auto_install = false, - }, - }, + opts = {}, }, } diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua deleted file mode 100644 index 9409537..0000000 --- a/lua/plugins/lualine.lua +++ /dev/null @@ -1,233 +0,0 @@ -return { - "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - local native_colorscheme = require "config.native-colorscheme" - local colors = native_colorscheme.colors - local config = { lualine_bold = true } -- Default config since we're not using solarized-osaka plugin - - local personal_colors = { - normal = { - a = { bg = colors.base03, fg = colors.blue100 }, - b = { bg = colors.fg, fg = colors.bg }, - c = { bg = colors.bg_statusline, fg = colors.fg }, - }, - insert = { - a = { bg = colors.base03, fg = colors.green100 }, - }, - - command = { - a = { bg = colors.base03, fg = colors.yellow100 }, - }, - - visual = { - a = { bg = colors.base03, fg = colors.magenta100 }, - }, - - replace = { - a = { bg = colors.base03, fg = colors.red100 }, - }, - - terminal = { - a = { bg = colors.base03, fg = colors.orange100 }, - }, - - inactive = { - a = { bg = colors.bg_statusline, fg = colors.blue }, - b = { bg = colors.bg_statusline, fg = colors.fg, gui = "bold" }, - c = { bg = colors.bg_statusline, fg = colors.fg }, - }, - } - - for _, mode in pairs(personal_colors) do - if config.lualine_bold then - mode.a.gui = "bold" - end - end - - -- local empty = require('lualine.component'):extend() - - -- local function jarak() - -- return ' ' - -- end - - local empty = require("lualine.component"):extend() - function empty:draw(default_highlight) - self.status = "" - self.applied_separator = "" - self:apply_highlights(default_highlight) - self:apply_section_separators() - return self.status - end - - local function process_sections(sections) - for name, section in pairs(sections) do - local left = name:sub(9, 10) < "x" - for pos = 1, name ~= "lualine_z" and #section or #section - 1 do - table.insert(section, pos * 2, { empty, color = { fg = colors.base03, bg = colors.base03 } }) - end - for id, comp in ipairs(section) do - if type(comp) ~= "table" then - comp = { comp } - section[id] = comp - end - -- comp.separator = left and { right = '' } or { left = '' } - comp.separator = left and { right = " " } or { left = " " } - -- comp.separator = {left = '' } and { right = '' } - end - end - return sections - end - - local lazy_status = require "lazy.status" - - require("lualine").setup { - options = { - theme = personal_colors, - -- icons_enabled = true, - -- component_separators = { left = '>', right = '┇' }, - -- section_separators = {left = '', right = '' }, - }, - sections = process_sections { - lualine_a = { - { - "mode", - icons_enabled = true, - icon = { - " ", - color = { fg = colors.base4, bg = colors.base03, gui = "bold" }, - }, - -- color = { fg = colors.base0, bg = colors.green300, gui = 'bold' }, - -- separator = { left = '', right = '' }, - -- left_padding = 2, right_padding = 0, - }, - }, - -- lualine_b = { 'filename', 'branch' }, - lualine_b = { - { - "branch", - -- separator = { left = '', right = '' }, - -- left_padding = 0, right_padding = 2, - icon = { - "", - -- align = 'left', - color = { fg = colors.orange100, bg = colors.base03, gui = "bold" }, - -- -- separator = {left = '', right = ''} - }, - -- left_padding = 0, - color = { fg = colors.orange100, bg = colors.base03, gui = "bold" }, - }, - { - "diff", - -- separator = { right = '',left = ''}, - colored = true, - symbols = { added = " ", modified = " ", removed = " " }, - diff_color = { - added = { fg = colors.green300, bg = colors.base03, gui = "bold" }, - modified = { fg = colors.yellow300, bg = colors.base03, gui = "bold" }, - removed = { fg = colors.red300, bg = colors.base03, gui = "bold" }, - }, - }, - }, - lualine_c = { - { - "filename", - on_click = function() - Snacks.picker.files() - -- print('file name clicked') - end, - icon = " ", - color = { fg = colors.yellow100, bg = colors.base03, gui = "bold" }, - path = 4, - file_status = false, - -- separator = { right = '┇', left = '┇'}, - }, - }, - lualine_x = { - { - "diagnostics", - on_click = function() - Snacks.picker.diagnostics() - end, - -- separator = { left = '' }, - sources = { "nvim_diagnostic" }, - sections = { "error", "warn", "info", "hint" }, - - diagnostics_color = { - error = { fg = colors.red300, bg = colors.base03, gui = "bold" }, -- Changes diagnostics' error color. - added = { fg = colors.green300, bg = colors.base03, gui = "bold" }, - warn = { fg = colors.yellow300, bg = colors.base03, gui = "bold" }, -- Changes diagnostics' warn color. - info = { fg = colors.blue300, bg = colors.base03, gui = "bold" }, -- Changes diagnostics' info color. - hint = { fg = colors.cyan300, bg = colors.base03, gui = "bold" }, -- Changes diagnostics' hint color. - }, - symbols = { error = " ", warn = " ", hint = "󰠠 ", info = " " }, - colored = true, -- Displays diagnostics status in color if set to true. - update_in_insert = true, -- Update diagnostics in insert mode. default = false - always_visible = false, -- Show diagnostics even if there are none. - }, - { - lazy_status.updates, - cond = lazy_status.has_updates, - color = { fg = colors.orange300 }, - }, - { - -- code from https://github.com/nvim-lualine/lualine.nvim/blob/566b7036f717f3d676362742630518a47f132fff/examples/evil_lualine.lua - -- Lsp server name . - function() - local msg = "No LSP" - local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 }) - local clients = vim.lsp.get_clients() - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end - end - return msg - end, - -- icon = ' LSP:', - -- icon = {' ', color = {bg = colors.base03, fg = colors.red100}}, - -- separator = { left = '', right = ''}, - -- separator = { left = ' ', right = ' '}, - color = { fg = colors.base4, gui = "bold", bg = colors.base03 }, - }, - - { - "filetype", - color = { bg = colors.base03, fg = colors.magenta100, gui = "bold" }, - -- separator = { left = '', right = ' ' }, - }, - }, - lualine_y = { - { - "progress", - left_padding = 0, - color = { bg = colors.base03, fg = colors.cyan100, gui = "bold" }, - }, - }, - lualine_z = { - { - -- 'location', - -- function() - -- return "Ln:%l Col:%c" - -- end - -- separator = { right = '' }, left_padding = 2 }, - }, - }, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { "filename" }, - lualine_x = { "location" }, - lualine_y = {}, - lualine_z = {}, - }, - tabline = {}, - extensions = {}, - } - end, -} diff --git a/lua/plugins/menu.lua b/lua/plugins/menu.lua deleted file mode 100644 index aa5a4d1..0000000 --- a/lua/plugins/menu.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - -- Dependency required by nvzone/menu - { "nvzone/volt", lazy = true }, - - { - "nvzone/menu", - lazy = true, - keys = { - { - "um", - function() - local ok, menu = pcall(require, "menu") - if not ok then - vim.notify("menu.nvim no disponible", vim.log.levels.ERROR) - return - end - local ok_items, items = pcall(require, "menus.oil") - if not ok_items then - vim.notify("menus.oil no encontrado", vim.log.levels.ERROR) - return - end - menu.open(items) - end, - desc = "Abrir menú de Oil", - }, - }, - }, -} diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua deleted file mode 100644 index 3fa0493..0000000 --- a/lua/plugins/mini.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - 'echasnovski/mini.nvim', - dependencies = { - 'echasnovski/mini.icons', - }, - version = false -} diff --git a/lua/plugins/minty.lua b/lua/plugins/minty.lua index 87a15bc..cb1775f 100644 --- a/lua/plugins/minty.lua +++ b/lua/plugins/minty.lua @@ -1,5 +1,5 @@ return { - -- volt is required by minty + -- volt es requerido por minty (motor de UI) { "nvzone/volt", lazy = true }, { @@ -11,8 +11,30 @@ return { }, config = function() require("minty").setup({ - -- Configuraciones opcionales - -- Por ejemplo, para auto-insertar el color seleccionado + huefy = { + border = false, + position = "cursor", -- cursor | center | func(w, h) + + -- Hook (no documentado) para añadir teclas dentro del picker. + -- minty ya trae = "Save": reemplaza el hex bajo el cursor. + -- Aquí añadimos = insertar el color elegido en el cursor, + -- útil cuando NO hay un hex debajo para reemplazar. + mappings = function(bufs) + local state = require("minty.huefy.state") + for _, buf in ipairs(bufs) do + vim.keymap.set("n", "", function() + local hex = "#" .. state.new_hex + require("volt").close() + vim.api.nvim_put({ hex }, "c", true, true) + end, { buffer = buf, desc = "Minty: insertar color en el cursor" }) + end + end, + }, + + shades = { + border = true, + position = "cursor", + }, }) end, }, diff --git a/lua/plugins/navigator.lua b/lua/plugins/navigator.lua deleted file mode 100644 index 954dfeb..0000000 --- a/lua/plugins/navigator.lua +++ /dev/null @@ -1,41 +0,0 @@ --- [[ --- Use or :q! to kill the floating window --- (or , ) to move --- or to open location or apply code actions. Note: might be bound in insert mode by other plugins --- ]] -return { - { - "ray-x/navigator.lua", - event = "LspAttach", - dependencies = { - { "ray-x/guihua.lua", build = "cd lua/fzy && make" }, - }, - opts = { - default_mapping = false, - lsp = { - disable_lsp = "all", -- Uses native LSP configuration instead of lspconfig - format_on_save = false, - hover = { - enable = false, - }, - }, - }, - -- Refer more usage on https://raw.githubusercontent.com/ray-x/navigator.lua/master/lua/navigator/lspclient/mapping.lua - keys = { - { "gr", ":lua require'navigator.reference'.async_ref()", desc = "Navigator - Async reference" }, - { "gS", ":lua require'navigator.symbols'.document_symbols()", desc = "Navigator - Document symbols" }, - { - "gw", - ":lua require'navigator.workspace'.workspace_symbol_live()", - desc = "Navigator - workspace symbols live", - }, - { "gd", ":lua require'navigator.definition'.definition()", desc = "Navigator - Definition" }, - { - "gp", - ":lua require'navigator.definition'.definition_preview()", - desc = "Navigator - Definition preview", - }, - { "ga", ":lua require'navigator.codeAction'.code_action()", desc = "Navigator - Code Action" }, - }, - }, -} diff --git a/lua/plugins/neorg.lua b/lua/plugins/neorg.lua index bf27994..4fc6e10 100644 --- a/lua/plugins/neorg.lua +++ b/lua/plugins/neorg.lua @@ -1,6 +1,7 @@ return { "nvim-neorg/neorg", - build = ":Neorg sync-parsers", + -- `:Neorg sync-parsers` usa `nvim-treesitter.install`, que no existe en la + -- rama `main`. Los parsers norg/norg_meta se instalan aparte (scanner en C++). cmd = { "Neorg" }, dependencies = { "nvim-lua/plenary.nvim" }, config = function() diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua index c00f12e..e953dae 100644 --- a/lua/plugins/neotest.lua +++ b/lua/plugins/neotest.lua @@ -5,7 +5,6 @@ return { dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", - "antoinemadec/FixCursorHold.nvim", "nvim-neotest/neotest-go", "nvim-neotest/neotest-plenary", "nvim-neotest/neotest-vim-test", diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua index 57dd934..88b9319 100644 --- a/lua/plugins/noice.lua +++ b/lua/plugins/noice.lua @@ -1,4 +1,6 @@ return { + -- Noice mínimo: SOLO la cmdline centrada (popup) y su menú de completado. + -- Mensajes, notificaciones y LSP quedan en manos nativas/snacks.notifier. "folke/noice.nvim", dependencies = { "MunifTanjim/nui.nvim", @@ -7,238 +9,31 @@ return { enabled = not vim.g.started_by_firenvim, opts = { cmdline = { - enabled = true, -- enables the Noice cmdline UI - view = "cmdline_popup", -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom - opts = {}, -- global options for the cmdline. See section on views - ---@type table + enabled = true, + view = "cmdline_popup", format = { - -- conceal: (default=true) This will hide the text in the cmdline that matches the pattern. - -- view: (default is cmdline view) - -- opts: any options passed to the view - -- icon_hl_group: optional hl_group for the icon - -- title: set to anything or empty string to hide - cmdline = { pattern = "^:", icon = "", lang = "vim" }, - search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" }, - search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" }, + cmdline = { pattern = "^:", icon = "", lang = "vim" }, + search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" }, + search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" }, filter = { pattern = "^:%s*!", icon = "$", lang = "bash" }, - lua = { pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" }, icon = "", lang = "lua" }, - help = { pattern = "^:%s*he?l?p?%s+", icon = "" }, - input = { view = "cmdline_input", icon = "󰥻 " }, -- Used by input() - -- lua = false, -- to disable a format, set to `false` + lua = { pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" }, icon = "", lang = "lua" }, + help = { pattern = "^:%s*he?l?p?%s+", icon = "" }, + input = { view = "cmdline_input", icon = "󰥻 " }, }, }, - messages = { - -- NOTE: If you enable messages, then the cmdline is enabled automatically. - -- This is a current Neovim limitation. - enabled = true, -- enables the Noice messages UI - view = "notify", -- default view for messages - view_error = "notify", -- view for errors - view_warn = "notify", -- view for warnings - view_history = "messages", -- view for :messages - view_search = "virtualtext", -- view for search count messages. Set to `false` to disable - }, popupmenu = { - enabled = true, -- enables the Noice popupmenu UI - ---@type 'nui'|'cmp' - backend = "nui", -- backend to use to show regular cmdline completions - ---@type NoicePopupmenuItemKind|false - -- Icons for completion item kinds (see defaults at noice.config.icons.kinds) - kind_icons = {}, -- set to `false` to disable icons - }, - -- default options for require('noice').redirect - -- see the section on Command Redirection - ---@type NoiceRouteConfig - redirect = { - view = "popup", - filter = { event = "msg_show" }, - }, - -- You can add any custom commands below that will be available with `:Noice command` - ---@type table - commands = { - history = { - -- options for the message history that you get with `:Noice` - view = "split", - opts = { enter = true, format = "details" }, - filter = { - any = { - { event = "notify" }, - { error = true }, - { warning = true }, - { event = "msg_show", kind = { "" } }, - { event = "lsp", kind = "message" }, - }, - }, - }, - -- :Noice last - last = { - view = "popup", - opts = { enter = true, format = "details" }, - filter = { - any = { - { event = "notify" }, - { error = true }, -