Tuesday, December 5, 2023

Importing values from vim to python in vim9

I installed vim 9 but still have multiple functions written in old vimscript.

I've read that functions written in old vimscript still work.

However I noticed that importing variables into Python `vim.eval("a:myvariable")` no longer works

I don't always get the right values imported.

Example :

:call MyFunction("12", "14") 

function! MyFunction("variable1, variable2") 
python3 << endpython 
variable1 = vim.eval("a:variable1") 
variable2 = vim.eval("a:variable2") 
print(variable1 + " " + variable2) 
endpython 

endfunction

What's wrong in above code?

Or better... why doesn't it work anymore in vim9?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/cce40585-46a4-4967-8f09-2aaf8398d117n%40googlegroups.com.

No comments:

Post a Comment