So I have a bit of weird situation. I use a plugin for yanking/pasting and have a clipboard manager on my laptop. These are linked up so I can copy/paste inside and outside of vim all as one. The issue is that clipboard managers on macOS have to work by polling the clipboard because there’s no notification to subscribe to. So they will poll it every 100-500ms. When using macros in Vim, this means that often times my yanking/pasting will be completely screwed up because my pastes will be ~500ms out of sync with what I yanked. This is obviously not an issue when it’s me typing normally as I don’t need to yank and paste repeatedly within 500ms, but a macro sometimes does.
Since my setup is working exactly how I want it outside of macros, my idea was to just use a different register inside macros(since this won’t need to interact with the system clipboard and timing won’t be an issue). For example my typical y
and p
commands would be mapped to "ay
and "ap
in the macro. I’ve setup a mapping so that normally y
/p
is handled by the plugin, and when a macro is recording y
/p
is mapped to "ay
/"ap
. The mapping is working correctly(I can see the yanked text in the a
register from the macro), but the macro records yiwp
as exactly that yiwp
, rather than "ayiw"ap
, which means when I try to replay the macro it’s using the normal/system-linked register(i believe =
) since it’s no longer recording a macro.
I’ve included all that info incase this is an XY problem, but is it possible to remap a key such that the macro records the mapped version of the key rather than the literal key that was pressed? So for my example if I literally type qqyiwpq
, my q
register would contain "ayiw"ap
.