IT WORKSga .
This commit is contained in:
parent
e5708ff4ed
commit
75a6f762d0
1 changed files with 5 additions and 6 deletions
|
@ -51,17 +51,16 @@ M.snippet_picker = function()
|
|||
attach_mappings = function(_, map)
|
||||
map("i", "<CR>", 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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue