From e0d86b513313c11667e5c55e61ce837c8fdf6c4f Mon Sep 17 00:00:00 2001 From: Frairlyn Camilo Roque Suarez Date: Sun, 7 Dec 2025 18:33:28 -0400 Subject: [PATCH] Add option to insert snippet after cursor --- lua/telescope/_extensions/luasnip.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/telescope/_extensions/luasnip.lua b/lua/telescope/_extensions/luasnip.lua index ce5cefa..198a47d 100644 --- a/lua/telescope/_extensions/luasnip.lua +++ b/lua/telescope/_extensions/luasnip.lua @@ -69,6 +69,7 @@ local _opts = { preview = { check_mime_type = true, }, + insert_after_cursor = false } M.opts = _opts @@ -162,7 +163,11 @@ M.luasnip_fn = function(opts) -- Use first snippet to expand if (#snippetsToExpand > 0) then - vim.cmd(':startinsert!') + if M.opts.insert_after_cursor then + vim.api.nvim_feedkeys('a', 'n', false) + else + vim.cmd(':startinsert!') + end vim.defer_fn(function() luasnip.snip_expand(snippetsToExpand[1]) end, 50) else error(