From 14bf34bb2a0d77560314105c9ffdc5a63c611a96 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Mon, 26 May 2025 05:44:20 +0200 Subject: [PATCH] Switched to blink.cmp --- nvim/dot-config/nvim/lazy-lock.json | 10 +- nvim/dot-config/nvim/lua/autocmds.lua | 6 +- nvim/dot-config/nvim/lua/plugins/blink.lua | 123 ++++++++++++++++++ nvim/dot-config/nvim/lua/plugins/cmp.lua | 102 --------------- .../nvim/lua/plugins/lsp_signature.lua | 14 -- nvim/dot-config/nvim/lua/themes/gruvbox.lua | 12 +- 6 files changed, 135 insertions(+), 132 deletions(-) create mode 100644 nvim/dot-config/nvim/lua/plugins/blink.lua delete mode 100644 nvim/dot-config/nvim/lua/plugins/cmp.lua delete mode 100644 nvim/dot-config/nvim/lua/plugins/lsp_signature.lua diff --git a/nvim/dot-config/nvim/lazy-lock.json b/nvim/dot-config/nvim/lazy-lock.json index 22af9d2..34a56d2 100644 --- a/nvim/dot-config/nvim/lazy-lock.json +++ b/nvim/dot-config/nvim/lazy-lock.json @@ -1,13 +1,11 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" }, + "blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "bufresize.nvim": { "branch": "master", "commit": "3b19527ab936d6910484dcc20fb59bdb12322d8b" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, - "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "gitsigns.nvim": { "branch": "main", "commit": "8b729e489f1475615dc6c9737da917b3bc163605" }, "gruvbox.nvim": { "branch": "main", "commit": "00e38a379bab3389e187b3953566d67d494dfddd" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, @@ -16,8 +14,6 @@ "kubernetes.nvim": { "branch": "main", "commit": "1a08abc6c0694f0d1f5d6725bfa7a88daf0f7246" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, - "lsp_signature.nvim": { "branch": "master", "commit": "2b30d8582126a12a493b737e9761969eb869a05b" }, - "lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, "mason-conform.nvim": { "branch": "main", "commit": "f3b96fa2217fcb1513301eefbe10ea0e765e33eb" }, @@ -28,8 +24,6 @@ "nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" }, "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" }, - "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-cmp-lsp-rs": { "branch": "main", "commit": "57f29333e6d2b655d5b0edb999b0006d49fde0ca" }, "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, "nvim-dap": { "branch": "master", "commit": "b0f983507e3702f073bfe1516846e58b56d4e42f" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, diff --git a/nvim/dot-config/nvim/lua/autocmds.lua b/nvim/dot-config/nvim/lua/autocmds.lua index 8ed362f..481f8f9 100644 --- a/nvim/dot-config/nvim/lua/autocmds.lua +++ b/nvim/dot-config/nvim/lua/autocmds.lua @@ -93,9 +93,9 @@ vim.api.nvim_create_autocmd("LspAttach", { vim.keymap.set("n", "K", function() vim.lsp.buf.hover({ border = border }) end, { desc = "Hover Documentation" }) - vim.keymap.set("n", "", function() - vim.lsp.buf.signature_help({ border = border }) - end, { desc = "Signature Documentation" }) + -- vim.keymap.set("n", "", function() + -- vim.lsp.buf.signature_help({ border = border }) + -- end, { desc = "Signature Documentation" }) end, }) diff --git a/nvim/dot-config/nvim/lua/plugins/blink.lua b/nvim/dot-config/nvim/lua/plugins/blink.lua new file mode 100644 index 0000000..202078f --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/blink.lua @@ -0,0 +1,123 @@ +local window = require("symbols.window") +return { + "saghen/blink.cmp", + -- optional: provides snippets for the snippet source + dependencies = { "rafamadriz/friendly-snippets" }, + + -- use a release tag to download pre-built binaries + version = "1.*", + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- See :h blink-cmp-config-keymap for defining your own keymap + -- keymap = { preset = "default" }, + keymap = { + preset = "default", + -- [""] = {function(cmp) cmp.scroll_documentation_up(4) end}, + -- [""] = {function(cmp) cmp.scroll_documentation_down(4) end}, + [""] = { "show", "show_documentation", "hide_documentation" }, + [""] = { "scroll_documentation_up" }, + [""] = { "scroll_documentation_down" }, + + [""] = { "accept", "fallback" }, + [""] = { "cancel", "fallback" }, + + [""] = { "select_next", "snippet_forward", "fallback" }, + [""] = { "select_prev", "snippet_backward", "fallback" }, + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + [""] = { "select_prev", "fallback_to_mappings" }, + [""] = { "select_next", "fallback_to_mappings" }, + + -- TODO: Does not appear to work? + [""] = { "show_signature", "hide_signature", "fallback" }, + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { + ghost_text = { + enabled = true, + }, + list = { + selection = { + preselect = false, + -- preselect = function(ctx) + -- return vim.bo.filetype ~= "markdown" + -- end, + }, + }, + documentation = { + auto_show = true, + auto_show_delay_ms = 0, + window = { + border = window.border, + }, + }, + menu = { + auto_show = true, + draw = { + columns = { + { "label", "label_description", gap = 1 }, + { "kind", "source_name", gap = 1 }, + }, + components = { + source_name = { + text = function(ctx) + if ctx.source_id ~= "snippets" then + return "[" .. ctx.source_name .. "]" + end + end, + }, + }, + }, + border = window.border, + }, + }, + + signature = { + enabled = true, + window = { + border = window.border, + }, + trigger = { + show_on_accept = true, + show_on_insert = true, + }, + }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { + "lazydev", + "lsp", + "path", + "snippets", + "buffer", + }, + providers = { + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + -- make lazydev completions top priority (see `:h blink.cmp`) + score_offset = 100, + }, + }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, +} diff --git a/nvim/dot-config/nvim/lua/plugins/cmp.lua b/nvim/dot-config/nvim/lua/plugins/cmp.lua deleted file mode 100644 index 3124fb8..0000000 --- a/nvim/dot-config/nvim/lua/plugins/cmp.lua +++ /dev/null @@ -1,102 +0,0 @@ --- https://github.com/hrsh7th/nvim-cmp -return { - { - -- Autocompletion - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - "onsails/lspkind-nvim", - - -- Snippets - "L3MON4D3/LuaSnip", - "saadparwaiz1/cmp_luasnip", - }, - config = function() - local cmp = require("cmp") - local luasnip = require("luasnip") - local lspkind = require("lspkind") - local border = require("symbols.window").border - - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { completeopt = "menu,menuone,noinsert" }, - window = { - completion = cmp.config.window.bordered({ - border = border, - winhighlight = "CursorLine:CmpSelection", - }), - documentation = cmp.config.window.bordered({ border = border }), - }, - -- Include the source of the cmp entry - formatting = { - format = lspkind.cmp_format({ - mode = "text", - menu = { - nvim_lsp = "LSP", - luasnip = "LuaSnip", - path = "Path", - }, - }), - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete({}), - [""] = cmp.mapping.confirm({ - select = true, - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.abort() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - 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_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }), - sources = { - { name = "lazydev", group_index = 0 }, - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "path" }, - }, - }) - end, - }, - { - "L3MON4D3/LuaSnip", - build = "make install_jsregexp", - cond = function() - return vim.fn.executable("make") == 1 - end, - config = function() - require("luasnip").config.setup() - -- require("luasnip.loaders.from_vscode").lazy_load() - end, - dependencies = { - -- "rafamadriz/friendly-snippets", - }, - }, -} diff --git a/nvim/dot-config/nvim/lua/plugins/lsp_signature.lua b/nvim/dot-config/nvim/lua/plugins/lsp_signature.lua deleted file mode 100644 index 13fb4f0..0000000 --- a/nvim/dot-config/nvim/lua/plugins/lsp_signature.lua +++ /dev/null @@ -1,14 +0,0 @@ --- https://github.com/ray-x/lsp_signature.nvim -return { - "ray-x/lsp_signature.nvim", - event = "VeryLazy", - dependencies = { - "neovim/nvim-lspconfig", - }, - opts = { - hint_enable = false, - handler_opts = { - border = require("symbols.window").border, - }, - }, -} diff --git a/nvim/dot-config/nvim/lua/themes/gruvbox.lua b/nvim/dot-config/nvim/lua/themes/gruvbox.lua index 7ad9cbb..cd49802 100644 --- a/nvim/dot-config/nvim/lua/themes/gruvbox.lua +++ b/nvim/dot-config/nvim/lua/themes/gruvbox.lua @@ -27,11 +27,13 @@ return { TelescopeMatching = { fg = palette.bright_aqua, bold = true }, TelescopeSelection = { fg = palette.bright_blue }, TelescopeSelectionCaret = { link = "TelescopeSelection" }, - CmpItemAbbrMatch = { fg = palette.bright_aqua, bold = true }, - CmpItemAbbrMatchFuzzy = { link = "CmpItemAbbrMatch" }, - CmpItemMenu = { fg = palette.dark2 }, - CmpItemKindFunction = { fg = palette.bright_red }, - CmpSelection = { fg = palette.dark0, bg = palette.bright_blue }, + BlinkCmpMenu = { fg = palette.dark2 }, + BlinkCmpMenuBorder = { fg = palette.dark4 }, + BlinkCmpDocBorder = { fg = palette.dark4 }, + BlinkCmpDocSeparator = { fg = palette.dark4 }, + BlinkCmpSignatureHelpBorder = { fg = palette.dark4 }, + BlinkCmpKindFunction = { fg = palette.bright_red }, + BlinkCmpMenuSelection = { fg = palette.dark0, bg = palette.bright_blue }, LspReferenceText = { bg = palette.dark1 }, LspReferenceRead = { link = "LspReferenceText" }, LspReferenceWrite = { link = "LspReferenceText" },