Vim version details

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Vim version details

Paul Jolly
Hi all,

I've tried searching using various terms, but I can't find anything specific on this question.

Is there a way to get the Vim version number, short of redirecting the output of :version to a variable?

I want the major, minor and patch details to ultimately build a semver version.

I can obviously parse the output of :version (having first redirected it to a variable) but first wanted to check if there was a simpler (less brittle?) way.

Thanks in advance.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/3d8f388c-c5a5-4fa1-986f-81a17aaee28b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Vim version details

tooth pik
i do it the brittle way

On Mon, May 13, 2019 at 10:38 AM Paul Jolly <[hidden email]> wrote:

>
> Hi all,
>
> I've tried searching using various terms, but I can't find anything specific on this question.
>
> Is there a way to get the Vim version number, short of redirecting the output of :version to a variable?
>
> I want the major, minor and patch details to ultimately build a semver version.
>
> I can obviously parse the output of :version (having first redirected it to a variable) but first wanted to check if there was a simpler (less brittle?) way.
>
> Thanks in advance.
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/3d8f388c-c5a5-4fa1-986f-81a17aaee28b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CALfSX1xjGwP7oyn9pCF439k98FiGv6Jkty%2BqGa7nvXSaBLcD-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Vim version details

Tony Mechelynck
In reply to this post by Paul Jolly
On Mon, May 13, 2019 at 5:38 PM Paul Jolly <[hidden email]> wrote:

>
> Hi all,
>
> I've tried searching using various terms, but I can't find anything specific on this question.
>
> Is there a way to get the Vim version number, short of redirecting the output of :version to a variable?
>
> I want the major, minor and patch details to ultimately build a semver version.
>
> I can obviously parse the output of :version (having first redirected it to a variable) but first wanted to check if there was a simpler (less brittle?) way.
>
> Thanks in advance.

Major/minor can be got from |v:version|.

If you want to know if a specific patch is compiled-in (let's say
8.0.256) you can test

    if (version > 800) || (version == 800 && has('patch256'))

The above intentionally has more parentheses than is strictly
necessary, for the ease of the human reader.

Remember that patch presence/absence is conceptually not a number but
an array of booleans, and it may be quite a large array (for version
8.1 it has as of this writing 1330 bits and climbing): it is possible
for patch n to be compiled-in even if patch (n-1) isn't. AFAIK the
only way to get the full list of which patches are in and which ones
aren't, is to :redir the output of :version somewhere (e.g. to a
register) then to parse (if it exists) the line beginning "Included
patches:" which is near the top of that output. That line can be
absent if you got the initial release of that major/minor version with
no patches.

Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXs5kFfWezKhRthYXqdggxmt%2B_LboxCeUzJTRO5BnkNzzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.