I want to spellcheck a bunch of files with vim, so I run:
for a in *.txt do vim -c 'set spell' $a done
Now, in each file, I use
]s to find the next unknown word, and fix the typo or add it to my dictionary; and when I'm done I close the current file with
ZZ and the next one automatically opens.
That's fine, but for the vast majority of files, there are no typos to report, so I end up doing a lot of
ZZ, etc. It would be better if I could somehow do the following: start vim, but if there are no words in the file that the spellchecker doesn't know about, exit immediately. That way I wouldn't have to close files where there are no changes to make.
Is there a way to run vim and immediately exit when the spellchecker has no complaint about the file?