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

function! MyFunction()
python3 << EOF

# if <condition>:
#     return

print('Hello world')


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.