From 392e633f0e194be7aa0f510aad070e433f38b2e8 Mon Sep 17 00:00:00 2001 From: lootboxer <> Date: Fri, 18 Apr 2025 00:32:10 +0300 Subject: [PATCH] Friendly snippets, for blink.cmp --- init.lua | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index ca5ff1f3..0345f62e 100644 --- a/init.lua +++ b/init.lua @@ -858,12 +858,12 @@ require('lazy').setup({ -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, }, opts = {}, }, @@ -896,6 +896,18 @@ require('lazy').setup({ -- See :h blink-cmp-config-keymap for defining your own keymap preset = 'default', + [''] = { + function(cmp) + if cmp.snippet_active() then + return cmp.accept() + else + return cmp.select_and_accept() + end + end, + 'snippet_forward', + 'fallback', + }, + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps }, @@ -910,6 +922,9 @@ require('lazy').setup({ -- By default, you may press `` to show the documentation. -- Optionally, set `auto_show = true` to show the documentation after a delay. documentation = { auto_show = false, auto_show_delay_ms = 500 }, + ghost_text = { + enabled = true, + }, }, sources = {