From 9365a8e96827cbf7bc5adad6d29bcd05b4d761b2 Mon Sep 17 00:00:00 2001 From: bee Date: Tue, 5 May 2026 22:37:10 +0530 Subject: Migrate from nixcats to nix-wrapper-modules --- lua/bee/plugins/blink.lua | 150 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 lua/bee/plugins/blink.lua (limited to 'lua/bee/plugins/blink.lua') diff --git a/lua/bee/plugins/blink.lua b/lua/bee/plugins/blink.lua new file mode 100644 index 0000000..7fd147b --- /dev/null +++ b/lua/bee/plugins/blink.lua @@ -0,0 +1,150 @@ +local MP = ... +return { + { + "luasnip", + auto_enable = true, + dep_of = { "blink.cmp" }, + after = function(_) + local luasnip = require("luasnip") + require("luasnip.loaders.from_vscode").lazy_load() + luasnip.config.setup({}) + + local ls = require("luasnip") + local s = ls.snippet + local t = ls.text_node + local i = ls.insert_node + local extras = require("luasnip.extras") + local rep = extras.rep + local fmta = require("luasnip.extras.fmt").fmta + local c = ls.choice_node + local f = ls.function_node + local d = ls.dynamic_node + local sn = ls.snippet_node + + vim.keymap.set({ "i", "s" }, "", function() + if ls.choice_active() then + ls.change_choice(1) + end + end) + end, + }, + { + "colorful-menu.nvim", + auto_enable = true, + on_plugin = { "blink.cmp" }, + }, + { + "blink.cmp", + auto_enable = true, + event = { "InsertEnter", "CmdlineEnter" }, + after = function(_) + require("blink.cmp").setup({ + keymap = { preset = "default" }, + cmdline = { + enabled = true, + completion = { + menu = { + auto_show = true, + }, + }, + sources = function() + local type = vim.fn.getcmdtype() + -- Search forward and backward + if type == "/" or type == "?" then + return { "buffer" } + end + -- Commands + if type == ":" or type == "@" then + return { "cmdline" } + end + return {} + end, + }, + term = { + enabled = false, + }, + fuzzy = { + sorts = { + "exact", + "score", + "sort_text", + }, + }, + appearance = { + nerd_font_variant = "mono", + }, + signature = { + enabled = true, + window = { + show_documentation = true, + }, + }, + completion = { + menu = { + draw = { + columns = { + { "label", "label_description", gap = 1 }, + { "srckind" }, + }, + treesitter = { "lsp" }, + components = { + srckind = { + ellipsis = false, + width = { fill = true }, + text = function(ctx) + return ctx.kind + end, + highlight = function(ctx) + return ctx.kind_hl + end, + }, + label = { + text = function(ctx) + return require("colorful-menu").blink_components_text(ctx) + end, + highlight = function(ctx) + return require("colorful-menu").blink_components_highlight(ctx) + end, + }, + }, + }, + }, + documentation = { + auto_show = true, + }, + }, + ---@type blink.cmp.SnippetsConfig + snippets = { + preset = "luasnip", + active = function(filter) + local snippet = require("luasnip") + local blink = require("blink.cmp") + if snippet.in_snippet() and not blink.is_visible() then + return true + else + if not snippet.in_snippet() and vim.fn.mode() == "n" then + snippet.unlink_current() + vim.snippet.stop() + end + return false + end + end, + }, + sources = { + default = { "lsp", "path", "snippets", "buffer", "omni" }, + providers = { + path = { + score_offset = 50, + }, + lsp = { + score_offset = 40, + }, + snippets = { + score_offset = 40, + }, + }, + }, + }) + end, + }, +} -- cgit v1.3.1