Bug in simple script?
Opened this issue · 0 comments
nzbart commented
I tried the simple script in your readme, and had to change it to the following to fix some issues:
vim.keymap.set("n", "<Leader>eq", function()
-- ask user for which register they'd like to edit
print("Macro register: ")
local reg = vim.fn.getcharstr()
-- obtain the content of the register
local reg_content = vim.fn.getreg(reg)
-- present the register content to the user to edit
local replaced_reg_content = vim.fn.input("> ", reg_content)
-- take the user input and put it back into the register
vim.fn.setreg(reg, replaced_reg_content)
end, { silent = true, desc = "Edit a macro" })
With these fixes in place, I was able to edit the register. However, any special characters, such as backspace, are lost. Do you have any idea on how we can preserve them?