So it's really as simple as:
vim -c ':%s/e//g' -c ':wq' file.txt
There's no need to use "ex mode". You can if you want:
vim -e -c ':%s/e//g' -c ':wq' file.txt
It has the advantage of not messing with your terminal so much, but other than that there's little difference.
It seems using -es is more performant, I have noticed a small "blink" without it as Vim started up and quit
-s should make it silently.
below is what I used :
vim -es -c ":%s/restwechat/restci/g" -c ":%s/restwe/restjs/g" -c ":wq" testvim
vim use -c to allow commands and -es make it more performant,without -es there is a small "blink" when Vim started up and quit.
the order of above ":s" command could make a difference.
网友评论