Benji Fisher wrote:
On Sun, Sep 10, 2006 at 01:05:11PM +0000, Yakov Lerner wrote:
How can a script test for specific patchlevel ?
For example, I have vim 7.0.86 and I need to check in the script that
patchlevel is >= 7.0.86. But v:version is 700. How ? It would be
nice if to have patchlist available through some v: variable.

     I agree that a List of patch numbers would be convenient.  You can
test for a specific patch with has("patch86").

:help has-patch

HTH                                     --Benji Fisher


---- $VIM/plugin/patchlist.vim ---- start
" Global plugin to make a List of included patches
" Maintainer:      A.J.Mechelynck <[EMAIL PROTECTED]>
" Last change:     2006 Sep 11
" Version: 0.0

" run once only
if exists("g:patchList")
        finish
endif

" Let's assume a single version of Vim cannot have
" more than 999 patches.
" If that maximum is irrealistic, it can be changed.
if ! exists("g:maxPatch")
        let g:maxPatch = 1000
endif

" g:patchList : ordered List of all included patch numbers
" g:patchArray : string of (g:maxPatch) digits
" g:PatchArray()[n] is has("patch{n}") for all n (1 <= n < g:maxPatch)
" g:PatchArray()[0] is always 1 to represent the unpatched release

let s:i = 1
let g:patchList = []
let g:patchArray = "1"
while s:i < g:maxPatch
        let g:patchArray .= has("patch" . s:i)
        if g:patchArray[s:i]
                let g:patchList += [s:i]
        endif
endwhile
unlet s:i
let g:ver_patch = (version / 100) . "." . (version % 100) . "." .
        \ g:patchList[-1]
---- $VIM/plugin/patchlist.vim ---- end

Reply via email to