Reputation: 43
I'm trying to write vim plugin for easier work with cmake. I want it to read some values from json file: build_dir, generator, cmake VARS and then give vim user few functions: configure, build, maybe run.
I decided to use python, because it's easy to run cmake from it and easy to parse json. But i have problem with understanding where i need to save values from json.
I decided to just save them to vim variables, g:cmake_configuration_name
for example. But i didn't find way to do this. I read help python few times already and tried to google it, no luck.
Maybe that's just bad way to do this, so i need help with this too.
Upvotes: 1
Views: 99
Reputation: 94591
You cannot do this from code running in an external interpreter but you can do it from within vim
using builtin :python[3]
command. Example:
:py3 import vim
:py3 vim.command("let g:my_test_var = 'my test value'")
:py3 vim.command("echo g:my_test_var")
my test value
Upvotes: 2