Does vim
expose an api for manipulating argv
before the "main program" looks at it?
I want to be able to use the syntax:
$ vim /path/to/my/file:100
and have it mean the same thing as
$ vim +100 /path/to/my/file
if /path/to/my/file:100
does not itself exist.
I can potentially see writing a wrapper script that does something like the example below, but I would really prefer to keep the logic inside my .vimrc
if possible.
#!/usr/bin/env perl
use strict;
use warnings;
my @args;
foreach my $x (@ARGV) {
my $candidate = (not (-f $x)) and ($x =~ /:/);
if ($candidate) {
my ($path, $linum) = split /:/, $x, 2;
push @args, ("+" . $linum, $path);
} else {
push @args, $x;
}
}
exec "vim", @args;
v:argv
variable.