Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lua/telescope/_extensions/luasnip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ local _opts = {
preview = {
check_mime_type = true,
},
insert_after_cursor = false
}
M.opts = _opts

Expand Down Expand Up @@ -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(
Expand Down