Reputation: 4561
For example, processing positional arguments:
function! Example(arg)
python <<_EOF_
# do something with a:arg
_EOF_
endfunction
or the ... list:
function! Example(...)
python <<_EOF_
# do something with a:000, a:1, a:2, etc.
_EOF_
endfunction
Is there anyway I can do this?
Upvotes: 13
Views: 2246
Reputation: 172688
You can retrieve the function arguments just like any other Vimscript expression through vim.eval()
:
function! Example(arg)
python << _EOF_
import vim
print "arg is " + vim.eval("a:arg")
_EOF_
endfunction
Upvotes: 21