diff --git a/lua/telesnip/init.lua b/lua/telesnip/init.lua index fe4125e..2b5e9cf 100644 --- a/lua/telesnip/init.lua +++ b/lua/telesnip/init.lua @@ -51,17 +51,16 @@ M.snippet_picker = function() attach_mappings = function(_, map) map("i", "", function(prompt_bufnr) local selection = require("telescope.actions.state").get_selected_entry() - local snippet_content = table.concat(vim.fn.readfile(selection.path), "\n") - - -- Copy to clipboard - vim.fn.setreg("+", snippet_content) - vim.fn.setreg('"', snippet_content) + local snippet_content = vim.fn.readfile(selection.path) -- Close Telescope prompt require("telescope.actions").close(prompt_bufnr) + -- Insert snippet directly into the buffer + vim.api.nvim_put(snippet_content, "l", true, true) + -- Notify user - print("Snippet copied to clipboard. Press p to paste.") + print("Snippet inserted.") end) return true end,