A method that does not require messing with args is to put the list of files in a text file, and then use the :so command to run the commands in this file.
For example, if you want to open all files that end in .php in a given directory, first create files.txt containing a list of files added using any command you want to use to open them.
sp alpha.php sp bravo.php sp charlie.php
Then within vim:
:so files.txt
If the file list is long, it is relatively easy to create the files.txt file by redirecting the output of the ls file to the file, and then using the vim macro to add sp in front of each file name.
This is clearly not as elegant as using the args and argdo , but these commands are also much more complicated.
There may also be a way to do this with a single command on the command line, but even after 16 years, I still find vim programming weird and secret.
dirtside May 18 '15 at 18:47 2015-05-18 18:47
source share