From 9fef3df7ef3c385c98e1cc9a42567f79d3e2669c Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Mon, 12 May 2025 10:37:28 +0200 Subject: [PATCH] feat(blink): make it usable --- lua/weeheavy/plugins/lsp/blink.lua | 47 ++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/lua/weeheavy/plugins/lsp/blink.lua b/lua/weeheavy/plugins/lsp/blink.lua index 0f7296a..ca1fd60 100644 --- a/lua/weeheavy/plugins/lsp/blink.lua +++ b/lua/weeheavy/plugins/lsp/blink.lua @@ -3,7 +3,7 @@ return { lazy = true, event = { "BufReadPre", "BufNewFile" }, -- optional: provides snippets for the snippet source - dependencies = { "rafamadriz/friendly-snippets" }, + dependencies = { "rafamadriz/friendly-snippets", "Kaiser-Yang/blink-cmp-git" }, -- use a release tag to download pre-built binaries version = "1.*", @@ -33,8 +33,10 @@ return { [""] = { "select_next", "fallback" }, [""] = { "accept", "fallback" }, [""] = { "cancel", "fallback" }, + [""] = { "scroll_documentation_down" }, + [""] = { "scroll_documentation_up" }, + [""] = { "show" }, }, - appearance = { -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' -- Adjusts spacing to ensure icons are aligned @@ -42,14 +44,49 @@ return { }, -- (Default) Only show the documentation popup when manually triggered - completion = { documentation = { auto_show = true } }, + completion = { + list = { + selection = { + preselect = false, + auto_insert = false, + }, + }, + documentation = { auto_show = true }, + -- Use text instead of icons in autocompletion menu + menu = { + draw = { + columns = { + { "label", "label_description", gap = 1 }, + { "kind_icon", "kind", gap = 1, "source_name" }, + }, + }, + }, + }, -- 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 = { "lsp", "path", "snippets" }, + providers = { + git = { + module = "blink-cmp-git", + name = "Git", + -- only enable this source when filetype is gitcommit, markdown, or 'octo' + enabled = function() + return vim.tbl_contains({ "octo", "gitcommit", "markdown" }, vim.bo.filetype) + end, + opts = { + -- options for the blink-cmp-git + }, + }, + }, + per_filetype = { + lua = { "lsp", "buffer", "path", "snippets" }, + markdown = { "lsp", "path", "snippets" }, -- do not add 'buffer' here, it's slow AF + text = { "buffer", "path" }, + ps1 = { "lsp", "buffer", "path", "snippets" }, + }, }, - -- (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"`