5

I think it would be very nice if I can check whether current vim was compiled with python support, instead of having error message popping out every time vim is launched.

Can this check be done in vimscript?

Note that running shell wouldn't work if multiple vim's are installed and user launch one of them:

vim --version | grep -q '\+python\>'

It would be considered as a better approach if it could be checked within vimscript alone.

11

How about

if has('python')
    ...
endif

See :help has() and :help feature-list at list item 1 and /python.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.