" Wrapper to emulate the nicer has() syntax for simultaneous version and patch " level checking that was introduced in v7.4.236 and fixed in v7.4.237. " " * " * " function! patch#(version) abort " If we're new enough, we can just use the native has() if has('patch-7.4.237') return has('patch-'.a:version) endif " Otherwise, we need to start splitting and comparing numbers let [major, minor, patch] = split(a:version, '\.') " The v:version variable looks like e.g. 801 for v8.1 let l:version = major * 100 + minor " If the version numbers are the same, return whether we have the patch; " otherwise, return whether the version " return v:version == l:version \ ? has('patch-'.patch) \ : v:version > l:version endfunction