0

When I use a command like vim -s script *.cfg it stops at the end of first file stating that there are x files left to edit and not executing the script in the remaining matching files.

script contains commands to format files and works when passing single file as argument.

What is the correct format to include all files with similar name and edit with same script file?

1
  • I don't want to open all files simultaneously i want to edit all .cfg files with the script but without entering their names one by one.
    – Magesh
    Jan 24 '19 at 6:03
2

Your vim script has to handle the looping through the buffer list. Or maybe you can handle it with :bufdo, see :help :bufdo.

Simpler:

for file in *.cfg; do
    vim -s scriptin "$file"
done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.