How can I access the arguments that were given to Vim on the command line under Windows?
I'm looking for the the equivalent to argv[]
in C.
Under linux you can read /proc/self/cmdline
.
Example:
vim -c ":echo split( readfile( \"/proc/self/cmdline\", 1 )[0], \"\n\" )"
print
[
'vim',
'-c',
':echo split( readfile( "/proc/self/cmdline", 1 )[0], "\n" )'
]
argc()
and argv()
don't work. They just return number of files.
Example:
vim -c ':echo "argc:" . argc() . ", argv:" . string( argv() )' file1 file2
print
argc:2, argv:['file1', 'file2']
:help argc()
:help argv()
:help argidx()
And maybe also :help argument-list
, just to be sure.
Simple example:
for arg in argv()
echo arg
endfor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With