hsnips
hsnips copied to clipboard
I can not undo the snippet expansion
Related to issue 27. I can not undo that!
snippet ( "()" iA
($1)$0
endsnippet
snippet `(?<=[a-zA-z])([0-9])` "d" iA
_``rv=m[1]``
endsnippet
Thanks for the report, the issue on both those examples is that the undo action is inserting exactly 1 character, and there is no way that I know of to tell the difference between an undo action and a user keypress. For instance, in your first example, if you selected the text ()
and typed (
, the edit event we receive would be exactly the same as the event we receive from the undo action.
I'll try to think of a solution for this, but nothing is coming to mind right now.
As a sidenote, in the second example you can fix this by actually matching the letters and numbers, instead of using a lookbehind, so it would look something like:
snippet `([a-zA-z])([0-9])` "d" iA
``rv=m[1]``_``rv=m[2]``
endsnippet