I try to do something similar to this question.
E.g. I have a python script in a file
/tmp/testme.py which should do different things depending on what argum
ents are passed to it:
import vim currentline = int(vim.eval('line(".")')) if vim.argument == "close": # quasi code here mylines = [ 'this is the script', 'and I say good bye!' ] else: mylines = [ 'this is the script', 'and I say hello!' ] vim.current.buffer[currentline:currentline] = mylines
And I intend to call it from vim with
:py3f /tmp/testme.py "close"
for the if branch or
for the else branch. Is there a way to pass arguments to scripts called with
The syntax I suggest above fails because
"close" is understood as second filename and vim tells me off
E172: Only one file name allowed
FileNotFoundError: [Errno 2] No such file or directory: "/tmp/testme.py 'close'"