Tuesday, January 26, 2010

Re: How to get vim patch version number in vim script?

On Tue, Jan 26, 2010 at 11:34 PM, John Little wrote:
> Sorry, prematurely posted.  Along the lines of
>
>     if !has("visual")
>        echo "Tiny"
>    elseif !has("eval")
>        echo "Small"
>    elseif !has("arabic")
>        echo "Normal"
>    elseif !has("profile")
>        echo "Big"
>    else
>        echo "Huge"
>    endif
>
> To me, the above clearly shows the clunkiness of the approach, I only
> did it for fun.

But, in practice, you're probably only concerned with one of those
features. Asking "does this vim binary support profiling" is a much
more meaningful question than "roughly what percentage of vim's
possible features were compiled into this particular binary".

As far as the patch level, the normal way to do it would be something
along the lines of

if v:version > 702 || (v:version == 702 && has('patch31'))

which returns true if the vim binary is from the yet-unreleased 7.3 or
higher, or if it's from vim 7.2 and includes patch 31. Incidentally,
that exact check could have been done more succinctly and readably
with

if exists('v:oldfiles')

~Matt

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: