我发现了一些可以帮助你的东西。for F in *.{c,h}pp ; do vim -c ":retab" -c ":wq" "$F" ; done 这应该能满足你的需求;)也许你需要根据自己的需求更改for循环条件。