How to use vim non-interactively
·Feb 19, 2016·
1 min read
If you want to use some feature of vim non-interactively, you can use
-ccommand argument. This will accept a vim command and will execute it on the input file.
You can use multiple -c arguments. For example:
vim -c '%s/data/DATA/g' -c 'wq' myfile
This will replace all occurrences of
Tip: You can combine this with
findcommand and have an automated find-and-replace script which acts on a set of files.