26 lines
586 B
Lua
26 lines
586 B
Lua
-- lua/chatgpt_nvim/handler.lua
|
|
-- No major changes needed, just ensure it can be reused for the new command.
|
|
-- Ensuring we have get_clipboard_content and write_file as is.
|
|
|
|
local M = {}
|
|
|
|
function M.get_clipboard_content()
|
|
return vim.fn.getreg('+')
|
|
end
|
|
|
|
function M.write_file(filepath, content)
|
|
local fd = vim.loop.fs_open(filepath, "w", 438)
|
|
if not fd then
|
|
vim.api.nvim_err_writeln("Could not open file: " .. filepath)
|
|
return
|
|
end
|
|
vim.loop.fs_write(fd, content, -1)
|
|
vim.loop.fs_close(fd)
|
|
end
|
|
|
|
function M.finish()
|
|
print("Finished processing files.")
|
|
end
|
|
|
|
return M
|