TransWikia.com

How to return from vimscript.python?

Vi and Vim Asked by niekas on August 31, 2021

I have a script written in vimscript-python, e.g.:

function! MyFunction()
python3 << EOF

# if <condition>:
#     return

print('Hello world')

EOF
endfunction

I want to add a check in the beginning of the script and if a check fails, the functions execution should be terminated. I tried using return and exit(), but return throws SyntaxError and exit() throws SystemExit exception. I want to stop execution without any errors.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP