For example, processing positional arguments:
JavaScript
x
8
1
function! Example(arg)
2
python <<_EOF_
3
4
# do something with a:arg
5
6
_EOF_
7
endfunction
8
or the … list:
JavaScript
1
8
1
function! Example( )
2
python <<_EOF_
3
4
# do something with a:000, a:1, a:2, etc.
5
6
_EOF_
7
endfunction
8
Is there anyway I can do this?
Advertisement
Answer
You can retrieve the function arguments just like any other Vimscript expression through vim.eval()
:
JavaScript
1
9
1
function! Example(arg)
2
python << _EOF_
3
4
import vim
5
print "arg is " + vim.eval("a:arg")
6
7
_EOF_
8
endfunction
9