I recently needed to re-indent a large number of files. I used variations of:
find . -type f -exec vim -c "normal gg=GZZ" {} \;
Which worked well, but incredibly slowly (across several hundred files, some of which have thousands of lines).
Is there a faster way to have used vim for this? (note: I'm not asking the general question of how to do re-indenting, but only if there is a faster method in vim)
Update: I attempted filbranden's answer and it was MUCH slower, but I don't think I was able to make a good apples to apples comparison, so it may not be fair to call it slower. My attempt using the args list never finished and I ended up killing it. It was progressing, but very slowly. I like having the args list approach in my toolbox; I'm sure it will be useful sometime.
For context, I ran this in git bash on Windows. The vim process was pretty steady at ~90 mb ram, but the system commit charge was really high at ~37 gb (which is abnormal on my 32 gb ram machine). I'm not a Windows memory expert, but I think that means it may have been swapping, which would certainly explain the slowness.