Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running a macro more than once fails for me #1989

Open
loosche opened this issue Aug 19, 2017 · 1 comment
Open

Running a macro more than once fails for me #1989

loosche opened this issue Aug 19, 2017 · 1 comment

Comments

@loosche
Copy link

loosche commented Aug 19, 2017

I'm in Visual Studio 2015 with VsVim Version 2.3.0.0 Installed Date 3/23/2017. (Great plugin by the way!) I also have Visual Assist installed which seems to get in the way sometimes.

Create a new text file with a bunch of python comment lines like this (don't even have to save it)

#Hello
#Hello
#Hello
#Hello
#Hello
#Hello

Then define a macro that will duplicate the line and change it into a print statement instead. I did it with this vim command line (starting anywhere on the first line)

q0yypdwiprint ESCjq

Then try to run that macro multiple times, which I did like this

@0@0@0@0

The first time works, but the second time doesn't.

@ricksladkey
Copy link
Collaborator

You should not use the numbered registers for macros. In vim, the numbered registers are special:

Numbered register 0 contains the text from the most recent yank command, unless the command specified another register with ["x].

So running the macro the first time caused the contents of the 0 register to be modified from what you recorded to what you yanked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants