diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2020-10-11 13:22:38 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2020-10-11 13:22:38 +1300 |
commit | fadf718ee8e6e3c8490e0d109d6c4f7d918df2f2 (patch) | |
tree | a4b00db6e999fe83652bc8fef8f550b183b6c6fd /vim/autoload/patch.vim | |
parent | Merge branch 'release/v10.12.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-10.13.0.tar.gz (sig) dotfiles-10.13.0.zip |
Merge branch 'release/v10.13.0'v10.13.0
* release/v10.13.0:
Break some lines to line things up
Inline environment retrieval to save a file load
Rewrite comments in patch#()
Diffstat (limited to 'vim/autoload/patch.vim')
-rw-r--r-- | vim/autoload/patch.vim | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/vim/autoload/patch.vim b/vim/autoload/patch.vim index 614be462..3a17ccda 100644 --- a/vim/autoload/patch.vim +++ b/vim/autoload/patch.vim @@ -6,19 +6,27 @@ " function! patch#(version) abort - " If we're new enough, we can just use the native has() + " If the Vim running is new enough for its has() function to support + " checking patch levels with version prefixes, we can just add a "patch-" + " prefix to the query, and pass it on to has(). + " if has('patch-7.4.237') return has('patch-'.a:version) endif - " Otherwise, we need to start splitting and comparing numbers + " Failing that, we need to do our own version number and patch number + " comparisons; split the queried version on dots. + " let [major, minor, patch] = split(a:version, '\.') - " The v:version variable looks like e.g. 801 for v8.1 + " The internal variable v:version describing the running Vim looks like + " e.g. 801 for v8.1; reproduce that logic for the queried version. + " let l:version = major * 100 + minor - " If the version numbers are the same, return whether we have the patch; - " otherwise, return whether the version + " If the running version number is the same as the required one, return + " whether we have the specific patch requested; otherwise, return whether + " the running version number is greater than the required one. " return v:version == l:version \ ? has('patch-'.patch) |