Using text-registers for macros (POC)
This commit is a POC for using plain text registers as Vim macro. Example:
- Create a new document, and insert "hello".
ihello<Esc>hello - Create an empty macro at register a.
qaq. This is currently required to get register a to be executable. - Insert the requested text macro.
oviwc123\<Esc\>A456\<Esc\><Esc>"ayiW. Note: I've escaped\<to note that I want the character '<', and not the '<Esc>' key. (point 4 will make this clearer, I think.) - See that register a contains the required text.
:reg a - Delete this line.
dd - Execute register a.
@a - You should get:
123456
The :2d passes, but others are failing now. I'll fix and let you know.
Okay. so I fixed some bugs in the tests. Now all of them passing.
I'll add some more tests, hopefully soon. Do you think anything else is needed, or it's fine like this?
For some reason I cannot make it work with <leader> in reamaps.
@J-Fields Do you know why?
Nope, I'll try to take a look sometime soon
Fixed it.
<leader> as a string is not handled by the handleKeyEvent. It has to be converted to the actual leader key. I added support for it + tests. see expression.ts#L4
Hey @elazarcoh what's the status of this - is it ready to merge?
It should be, yes. I couldn't think of any more things that need testing to make sure it doesn't break anything else. If you have an idea for what else should be tested, I can implement it.