Sunday, June 18, 2023

Re: How to know in which patch a feature was added

This isn't exactly what you asked for, but how about a custom command, such as Set, that calls a function to do the option set in a try/catch? If it succeeds, great. If it fails, you can just ignore it or use an echomsg or something.

You won't know when a feature was introduced, but you also won't have to have existence checks around everything. 

Salman

On Sun, Jun 18, 2023, 14:29 Tony Mechelynck <antoine.mechelynck@gmail.com> wrote:
On Sun, Jun 18, 2023 at 7:15 PM Enan Ajmain <3nan.ajmain@gmail.com> wrote:
>
> In the beginning, I used a simple vimrc, basically ":se nu", etc.  Those
> features were available in all available Vim installations.  Later when
> I got into tweaking, I used nightly builds of Vim, so I always had the
> latest features.  But nowadays I have to work in a few ssh machines,
> some of which have slightly older versions of Vim.  Which means some of
> my settings emit errors.
>
> The proper way to handle this is with ":has()" and ":exists()".  For
> checking the existence of things like functions, autocommand events,
> variables, etc., they work fine.  Even for options, I can use exists().
> But what about option values?  Let's say I want to set 'wildoptions' to
> use 'popupmenu'.  This was introduced in a late patch of 8.2.  The only
> way I can include this setting with sanity check is by using ":if
> has('patch-8.2.4325')".  The problem is: I had to find the patch number
> by using "git grep --log=pum".
>
> Is there an easier way to find the patch number where an option was
> introduced?  Perhaps with ":helpgrep"?
>
> --
> Enan

See
  :help version5.txt
  :help version6.txt
  :help version7.txt
  :help version8.txt
  :help version9.txt

Each of these begins with a section explaining what was new in version
n.0, then lower down there are a series of sections about versions
n.1, n.2 etc., each containing a series of short paragraphs about each
new patch concerning that section.

I suppose that anything added earlier than version 5.0 can now be
assumed to be "always present". For later features, the simplest is,
as you said, to take advantage, when possible, of the has() and
exists() functions. Only when neither of these gives the clear-cut
result you need, will you have to resort to checking by patch number,
after having searched (possibly with the Normal-mode / command) some
or all of the five helpfiles mentioned above.

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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsMg_Kk77G785oVt4jXaTFkiUvFWUZ6-4-e5SML08QjGQ%40mail.gmail.com.

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEc55LripVVmdt3BkZRu6h1qu5KPo_4MrR%2BKnEeeCYOQog%40mail.gmail.com.

No comments:

Post a Comment