1

Re: VS Macros/ViEmu interaction

Hi, I'm trying to record a VS macro and not all of my actions are recorded since they're going straight to ViEmu instead of the text editor. Is there a way to do one of the following?
a) record _all_ keystrokes, including ones intercepted by ViEmu, or
b) programmatically turn off ViEmu in a macro, execute the macro, and then turn ViEmu on again?

I'm sure other people must have have encountered this, but don't see anything in the FAQ or in a search of the forums.

2

Re: VS Macros/ViEmu interaction

Hi Jonp,

I'm not totally sure that I understand what you need, but the best way to use editing macros is to use vim/ViEmu's 'q' command. Follow it by a letter, and then end recording with 'q' again. '@' followed by the letter used will replay it. For example, the following sequence:

  qaxAhello<esc>q

Will record a character deletion ('x') and adding 'hello' to the end of the line in the register 'a'. You can play it back with '@a'.

Let me know if this is not what you'd want?

  - Jon

3

Re: VS Macros/ViEmu interaction

The ViEmu macros are useful for most tasks but don't persist between sessions (that I know of) or allow me to interact with the VS environment - features that are important for heavy lifting. However, when I try to record a VS macro with ViEmu turned on, not all of the actions are recorded. There are two workarounds to this that I can see:
a) turn off ViEmu, record a VS macro, and then turn ViEmu back on again. Since the macro is recorded without ViEmu, two lines would need to be added to the macro: one at the beginning that turns ViEmu off and one at the end that turns it back on again; or
b) somehow make VS macro recording keep track of all of the keystrokes, including the ones that currently are swallowed by

Either way would solve my problem, but as it stands, I have to manually turn ViEmu off, run the macro, and then turn ViEmu back on.

4

Re: VS Macros/ViEmu interaction

jonp, macros are just stored in regular registers (try pasting from a register after recording a macro there to see how keypresses are spelled out). This coul provide a way to persiste them, but, indeed, ViEmu is missing such a mechanism. Also, user-customizable interaction with theVisual Studio environment is still simplistic (the :mac[ro] and :vsc[md] ViEmu-specific ex commands).

It is pretty difficult to address the need you mention in a general case. ViEmu does some serious event and command interception, as that's the only way to get vi/vim emulation properly, and VS is not really prepared for such an interception.

Could you provide a more detailed scenario of what you are after? It might help me visualize it better and possibly provide a workaround.