且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过脚本中的vim将文件编码更改为utf-8

更新时间:2023-11-27 12:40:58

这是我知道的从命令行轻松完成这一操作的最简单的方法:

This is the simplest way I know of to do this easily from the command line:

vim +"argdo se bomb | se fileencoding=utf-8 | w" $(find . -type f -name *.php)

或者更好的是,如果文件数量预计相当大:

Or better yet if the number of files is expected to be pretty large:

find . -type f -name *.php | xargs vim +"argdo se bomb | se fileencoding=utf-8 | w"