From 165d3ccc203029721fbee9c785c3106a3ac00563 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 3 Jul 2026 03:27:58 +0200 Subject: [PATCH] blink.cmp --- nvim/.config/nvim/lua/romanzy/commands.lua | 32 +++++++++---------- nvim/.config/nvim/lua/romanzy/keymaps.lua | 13 ++++++-- nvim/.config/nvim/lua/romanzy/plugins.lua | 1 + .../nvim/lua/romanzy/plugins/blink-cmp.lua | 32 +++++++++++++++++++ nvim/.config/nvim/lua/romanzy/plugins/lsp.lua | 5 +-- nvim/.config/nvim/nvim-pack-lock.json | 8 +++++ 6 files changed, 68 insertions(+), 23 deletions(-) create mode 100644 nvim/.config/nvim/lua/romanzy/plugins/blink-cmp.lua diff --git a/nvim/.config/nvim/lua/romanzy/commands.lua b/nvim/.config/nvim/lua/romanzy/commands.lua index 7536b9e..f14aa79 100644 --- a/nvim/.config/nvim/lua/romanzy/commands.lua +++ b/nvim/.config/nvim/lua/romanzy/commands.lua @@ -2,25 +2,23 @@ local uc = vim.api.nvim_create_user_command local ac = vim.api.nvim_create_autocmd local aug = vim.api.nvim_create_augroup --- User commands uc("W", "w|e", { desc = "write file then refresh buffer" }) --- Auto commands ac("TextYankPost", { - desc = "Highlight when yanking text", - group = aug("highlight-yank", { clear = true }), - callback = function() - vim.highlight.on_yank() - end, -}) -ac("LspAttach", { - desc = "Notify user about attached LSP clients", - group = aug("LSPOnAttach", { clear = true }), - callback = function(event) - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client then - vim.notify(client.name .. " attached", vim.log.levels.INFO, {}) - end - end, + desc = "Highlight when yanking text", + group = aug("highlight-yank", { clear = true }), + callback = function() + vim.highlight.on_yank() + end, }) +ac("LspAttach", { + desc = "Notify user about attached LSP clients", + group = aug("LSPOnAttach", { clear = true }), + callback = function(event) + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client then + vim.notify(client.name .. " attached", vim.log.levels.INFO, {}) + end + end, +}) diff --git a/nvim/.config/nvim/lua/romanzy/keymaps.lua b/nvim/.config/nvim/lua/romanzy/keymaps.lua index c8d8165..89a7399 100644 --- a/nvim/.config/nvim/lua/romanzy/keymaps.lua +++ b/nvim/.config/nvim/lua/romanzy/keymaps.lua @@ -90,12 +90,21 @@ local function rename_without_default() end vim.api.nvim_create_autocmd("LspAttach", { + -- defaults are: + -- grn → Rename symbol + -- gra → Code actions + -- grr → Find references + -- gri → Go to implementation + -- grt → Go to type definition + -- gO → Document symbols callback = function(ev) map("n", "gd", vim.lsp.buf.definition, { buffer = ev.buf, desc = "goto definition" }) map("n", "gD", vim.lsp.buf.declaration, { buffer = ev.buf, desc = "goto declaration" }) + map("n", "gfr", vim.lsp.buf.references, { buffer = ev.buf, desc = "list references" }) map("n", "grd", vim.lsp.buf.references, { buffer = ev.buf, desc = "list references" }) - map("n", "grn", rename_without_default, { buffer = ev.buf, desc = "rename symbol" }) - map("i", "", vim.lsp.completion.get, { buffer = ev.buf, desc = "trigger completion" }) + map("n", "grn", rename_without_default, { buffer = ev.buf, desc = "rename symbol from zero" }) + map("n", "gRN", vim.lsp.buf.rename, { buffer = ev.buf, desc = "rename symbol" }) + -- map("i", "", vim.lsp.completion.get, { buffer = ev.buf, desc = "trigger completion" }) end, }) diff --git a/nvim/.config/nvim/lua/romanzy/plugins.lua b/nvim/.config/nvim/lua/romanzy/plugins.lua index 86c8e7b..9fe954d 100644 --- a/nvim/.config/nvim/lua/romanzy/plugins.lua +++ b/nvim/.config/nvim/lua/romanzy/plugins.lua @@ -1,5 +1,6 @@ require("romanzy.plugins.rose-pine") require("romanzy.plugins.mini") +require("romanzy.plugins.blink-cmp") require("romanzy.plugins.lazygit") require("romanzy.plugins.oil") require("romanzy.plugins.telescope") diff --git a/nvim/.config/nvim/lua/romanzy/plugins/blink-cmp.lua b/nvim/.config/nvim/lua/romanzy/plugins/blink-cmp.lua new file mode 100644 index 0000000..2d0a57a --- /dev/null +++ b/nvim/.config/nvim/lua/romanzy/plugins/blink-cmp.lua @@ -0,0 +1,32 @@ +vim.pack.add({ 'https://github.com/saghen/blink.lib', 'https://github.com/saghen/blink.cmp' }) + +local cmp = require('blink.cmp') +-- cmp.build():pwait() +cmp.setup({ + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = 'default' }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = false } }, + + -- (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 = { 'lsp', 'path', 'snippets', 'buffer' } }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` + -- See the fuzzy documentation for more information + -- fuzzy = { implementation = "prefer_rust_with_warning" } + fuzzy = { implementation = "lua" } +}) diff --git a/nvim/.config/nvim/lua/romanzy/plugins/lsp.lua b/nvim/.config/nvim/lua/romanzy/plugins/lsp.lua index 48d2f1c..5d47533 100644 --- a/nvim/.config/nvim/lua/romanzy/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/romanzy/plugins/lsp.lua @@ -15,9 +15,6 @@ vim.pack.add({ local mason_lspconfig = require("mason-lspconfig") -vim.opt.completeopt = { "menu", "menuone", "noselect", "popup", "fuzzy" } -vim.opt.pumheight = 8 - local diag_inline_enabled = true local function diag_virtual_text() @@ -59,7 +56,7 @@ vim.api.nvim_create_autocmd("LspAttach", { end, }) -local capabilities = vim.lsp.protocol.make_client_capabilities() +local capabilities = require("blink.cmp").get_lsp_capabilities() local managed_servers = { "bashls", "clangd", diff --git a/nvim/.config/nvim/nvim-pack-lock.json b/nvim/.config/nvim/nvim-pack-lock.json index 17ad897..88e0562 100644 --- a/nvim/.config/nvim/nvim-pack-lock.json +++ b/nvim/.config/nvim/nvim-pack-lock.json @@ -1,5 +1,13 @@ { "plugins": { + "blink.cmp": { + "rev": "bda905a4bf1b3edfa708b0be193b8c63d8620c96", + "src": "https://github.com/saghen/blink.cmp" + }, + "blink.lib": { + "rev": "5876dd95deeb70aadbe9f1c0b7117a135061cdac", + "src": "https://github.com/saghen/blink.lib" + }, "codam-header.nvim": { "rev": "a8fbd2a7003eecbf6e85693e85d7d4d464625193", "src": "https://github.com/BeerB34r/codam-header.nvim"