vim batch encoding conversion of files

1. Set the set of files, that is, which files to operate on, you can use wildcards. For example, I usually encode and convert C/C++ source programs:

:args *.h *.cpp

Second, give the command to be executed on each file, here is the conversion code:

:argdo set fenc=utf-8 | update

  That's ok, let's have fun. It should be noted here that if you want to execute multiple commands at the same time, you need to separate them with "|", and the above update must be written, because vim will give an error when editing the next file after a file has been modified and has not been saved. Prompt, using this update is to update the file, so this problem will not occur.

  Of course, args and argdo can do a lot of things, such as batch replacement in multiple files, which should be very practical. For details, you can check vim's help files :help args and :help argdo

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326620499&siteId=291194637