簡體   English   中英

如何從python代碼退出vim函數?

[英]How to exit a vim function from python code?

例:

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函數?

怎么樣:

function! MyFunc()
....

python << EOF

if ...:
   result=0
else:
   ...
   result=1

vim.command("let pyResult=%d"%result)
EOF

if pyResult == 0
   return
else
   ..........
endif
endfunction

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM