import json
# Some code that puts result into variable r
# This won't work if r contains non-unicode strings,
# you will have to write your own serializer in this case.
# As far as I know, it will also fail if some characters in the string
# can be represented only using surrogate pairs.
vim.command("let reply=".json.dumps(r))
# Now in the caller function variable l:reply is defined
所有非vimscript接口都会被诅咒:与vim通信的唯一方法(除非您想编辑/获取可以使用buffer对象的缓冲区内容)是}(python中的
execute
(python中的vim.command(string)
)和{vim.eval(string)
),两者都需要序列化参数。如果你想开始视觉模式使用或者
^{pr2}$一。但是,如果你想,例如,返回一些值给一个调用函数,你必须使用
相关问题 更多 >
编程相关推荐