In insert mode, allow to undo bracket-pasted content only
bew opened this issue · comments
Benoit de Chezelles commented
For example:
In insert mode
- write some text
- middle-click to paste something from the primary buffer (on X)
Realize you didn't paste the correct thing
- go back to normal mode
- undo
==> The pasted content AND the content inserted before the paste are undone.
👉 I want only the pasted text to be undone, and require a second undo for my text.
This seems to be possible by writing a custom paste handler by redefining vim.paste()
(in Lua).
See the help for ui-paste
(and vim.paste()
for impl details)
I'd have to first insert an undo/redo breakpoint (no idea how to do that) before the normal paste.