示例:
function! MyFunc()
do this
do that
python3 << endpython
if var = "something":
return
else:
do this
endpython
endfunction
return
命令不起作用:
E880:无法在vim中处理python异常的SystemExit
使用exit()
或quit()
如何从python代码中退出vim函数?
答案 0 :(得分:1)
怎么样:
function! MyFunc()
....
python << EOF
if ...:
result=0
else:
...
result=1
vim.command("let pyResult=%d"%result)
EOF
if pyResult == 0
return
else
..........
endif
endfunction