Invalidsearch
Invalidsearch

Reputation: 235

Applying a macro to all files under a folder

I am using gvim 7.4 on Windows.

I have a macro recorded that I want to apply on specific files (for example, *.sql) under a parent directory. If I open the file and press @q, the macro works perfectly fine.

Is there a way I can recursively search for all .sql files and apply the macro? I can do this manually by opening the individual files but I wanted to see if I could use a "search and apply macro" method.

Thanks!

Upvotes: 1

Views: 327

Answers (1)

Kent
Kent

Reputation: 195229

there are bufdo and argdo commands. At least you can trigger your macro in normal command.

something like:

:bufdo exe 'norm! @q' |w

give it a try.

Note, this will save the file after the macro is played.

Upvotes: 4

Related Questions