From 703b88587bf5bfa7468edffe35be956fe0a06f35 Mon Sep 17 00:00:00 2001 From: Elvis Claros Castro Date: Sat, 30 Aug 2025 14:26:57 -0300 Subject: =?UTF-8?q?feat(completion):=20migraci=C3=B3n=20a=20blink.cmp=20pa?= =?UTF-8?q?ra=20completado=20m=C3=A1s=20r=C3=A1pido=20e=20inteligente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Se reemplazó nvim-cmp y fuentes relacionadas por blink.cmp, incluyendo soporte para Copilot y LaTeX. Se actualizó la configuración de completado para mejorar el rendimiento, resistencia a errores tipográficos y mejor interfaz. Las completaciones DAP ahora se gestionan automáticamente. Se eliminaron cmp-dap y dependencias de plugins no utilizados. feat(ui): agrega nvzone/menu y minty para menús y selección de colores mejorados Se incorporó nvzone/menu para menús contextuales (Oil, Colores) y minty para paletas y selector de color avanzados. Se añadieron nuevas definiciones de menú y atajos para acceso rápido. refactor(lsp): actualiza capacidades LSP para integración con blink.cmp Se modificaron las capacidades del cliente LSP para usar blink.cmp y mejorar la experiencia de completado en todos los servidores. fix(dap): actualiza configuración del adaptador de Firefox para desarrollo local Se cambiaron los parámetros del adaptador de depuración de Firefox para ajustarse al entorno y puerto local. chore: elimina plugins no utilizados (vim-dadbod, deadcolumn, duck, easy-align, orgmode, llm) Se limpió la lista de plugins eliminando los no utilizados o deshabilitados para una configuración más ligera. style(colorscheme): mejora configuración de Solarized Osaka para mejor UI Se mejoró la configuración del esquema de colores con resaltados más legibles, mejores estilos para barras laterales/ventanas flotantes y retroalimentación visual mejorada. docs: agrega MIGRACION_BLINK.md con notas de migración Se añadió archivo de documentación para registrar los pasos y razones de la migración a blink.cmp. --- lua/pi/completition/init.lua | 240 +------------------------------------------ 1 file changed, 2 insertions(+), 238 deletions(-) (limited to 'lua/pi/completition/init.lua') diff --git a/lua/pi/completition/init.lua b/lua/pi/completition/init.lua index 73f13d1..4f93269 100644 --- a/lua/pi/completition/init.lua +++ b/lua/pi/completition/init.lua @@ -1,238 +1,2 @@ -local cmp = require "cmp" -local lspkind = require "lspkind" -local luasnip = require "luasnip" -local cmp_autopairs = require "nvim-autopairs.completion.cmp" -local compare = require "cmp.config.compare" - -cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } }) - -cmp.setup { - window = { - completion = { - border = "rounded", - -- winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None', - -- winblend = vim.o.pumblend, - -- scrolloff = 0, - -- col_offset = 0, - -- side_padding = 1, - -- scrollbar = true, - }, - documentation = { - -- max_height = math.floor(WIDE_HEIGHT * (WIDE_HEIGHT / vim.o.lines)), - -- max_width = math.floor((WIDE_HEIGHT * 2) * (vim.o.columns / (WIDE_HEIGHT * 2 * 16 / 9))), - border = "rounded", - -- winhighlight = 'FloatBorder:NormalFloat', - -- winblend = vim.o.pumblend, - }, - }, - mapping = { - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.close() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.choice_active() then - luasnip.change_choice(1) - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Insert, - select = true, - }, - [""] = cmp.mapping.complete(), - }, - sources = { - { name = "dictionary", keyword_length = 2 }, - { name = "nvim_lua" }, - { name = "nvim_lsp" }, - { name = "path" }, - { name = "luasnip" }, - { name = "copilot" }, - { name = "vimtex" }, - -- { name = 'cmp_ai' }, - { - name = "html-css", - option = { - spa = { - enable = false, -- SPA mode is disabled by default - entry_file = "index.html", -- if entry_file is omitted, it defaults to index.html in root dir - }, - max_count = {}, -- not ready yet - enable_on = { "html", "css" }, -- set the file types you want the plugin to work on - file_extensions = { "css", "sass", "less" }, -- set the local filetypes from which you want to derive classes - style_sheets = { - -- example of remote styles, only css no js for now - "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css", - "https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css", - }, - }, - }, - { - name = "buffer", - keyword_length = 4, - option = { - get_bufnrs = function() - local bufs = {} - for _, win in ipairs(vim.api.nvim_list_wins()) do - local bufnr = vim.api.nvim_win_get_buf(win) - local buftype = vim.api.nvim_get_option_value("buftype", { buf = bufnr }) - if buftype ~= "terminal" then - bufs[bufnr] = true - end - end - return vim.tbl_keys(bufs) - end, - }, - }, - }, - - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - - formatting = { - format = function(entry, vim_item) - if entry.source.name == "html-css" then - source_mapping["html-css"] = "[" .. entry.completion_item.provider .. "]" or "[html-css]" - end - local KIND_ICONS = { - Tailwind = "󰹞󰹞󰹞󰹞󰹞󰹞󰹞󰹞", - Copilot = "", - CodeCompanion = "", - Ollama = "", - Text = "󰉿", - Method = "󰆧", - Function = "󰊕", - Constructor = "", - Field = "󰜢", - Variable = "󰀫", - Class = "󰠱", - Interface = "", - Module = "", - Property = "󰜢", - Unit = "󰑭", - Value = "󰎠", - Enum = "", - Keyword = "󰌋", - Snippet = "", - Color = "󰏘", - File = "󰈙", - Reference = "󰈇", - Folder = "󰉋", - EnumMember = "", - Constant = "󰏿", - Struct = "󰙅", - Event = "", - Operator = "󰆕", - Codeium = "", - TypeParameter = "󰜅", - OpenAI = "", - TinyLlama = "󱝊", - LlamaCPP = "", - } - - if vim_item.kind == "Color" and entry.completion_item.documentation then - local _, _, r, g, b = - ---@diagnostic disable-next-line: param-type-mismatch - string.find(entry.completion_item.documentation, "^rgb%((%d+), (%d+), (%d+)") - - if r and g and b then - local color = string.format("%02x", r) .. string.format("%02x", g) .. string.format("%02x", b) - local group = "Tw_" .. color - - if vim.api.nvim_call_function("hlID", { group }) < 1 then - vim.api.nvim_command("highlight" .. " " .. group .. " " .. "guifg=#" .. color) - end - - vim_item.kind = KIND_ICONS.Tailwind - vim_item.kind_hl_group = group - - return vim_item - end - end - - vim_item.kind = KIND_ICONS[vim_item.kind] or vim_item.kind - -- Add maxwidth and ellipsis_char in the middle - local maxwidth = 50 - local ellipsis_char = "..." - if #vim_item.abbr > maxwidth then - local half_width = math.floor((maxwidth - #ellipsis_char) / 2) - vim_item.abbr = string.sub(vim_item.abbr, 1, half_width) - .. ellipsis_char - .. string.sub(vim_item.abbr, -half_width) - end - return vim_item - end, - }, - - sorting = { - priority_weight = 2, - comparators = { - compare.kind, - compare.sort_text, - }, - }, - - experimental = { - native_menu = false, - - ghost_text = false, - }, -} - -vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#3426C3" }) -vim.api.nvim_set_hl(0, "CmpItemKindCodeium", { fg = "#2ACDBA" }) -vim.api.nvim_set_hl(0, "CmpItemKindOllama", { fg = "#FDFEFF" }) -vim.api.nvim_set_hl(0, "CmpItemKindOpenAI", { fg = "#080808" }) -vim.api.nvim_set_hl(0, "CmpItemKindTinyLlama", { fg = "#DF468C" }) -vim.api.nvim_set_hl(0, "CmpItemKindLlamaCPP", { fg = "#FF8235" }) - --- Set configuration for specific filetype. -cmp.setup.filetype("gitcommit", { - sources = cmp.config.sources({ - { name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it. - }, { - { name = "buffer" }, - }), -}) - --- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline("/", { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "buffer" }, - }, -}) - --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "path" }, - }, { - { name = "cmdline" }, - }), -}) - -cmp.setup.filetype({ "sql", "mysql", "plsql" }, { - sources = cmp.config.sources({ - { name = "vim-dadbod-completion" }, - }, { - { name = "buffer" }, - }), -}) +-- Load blink.cmp configuration +require "pi.completition.blink" -- cgit v1.2.3