[CentOS] Feed a list of filenames to vim

Jerry Franz jfranz at freerun.com
Wed May 18 15:09:48 UTC 2011


On 05/18/2011 08:06 AM, Benjamin Franz wrote:
> On 05/17/2011 09:19 AM, Jussi Hirvi wrote:
>> There are some googlable ways to feed a list of filenames to vim, but I
>> stumble on weird results.
> [...]
>
> The easy way for me is 'avoid the shell - use Perl instead':
>
> perl -e 'my @files = grep(!/^\s*$/,<ARGV>); chomp @files;
> system("vim", at files);'  example_list.txt
>

Quick change to handle filenames that start with '-' as well:

perl -e 'my @files = grep(!/^\s*$/,<ARGV>); chomp @files; 
system("vim","--", at files);'  example_list.txt

-- 
Benjamin Franz



More information about the CentOS mailing list