4

Yesterday I made a change to my plugin which essentially consisted in using getcharstr() instead of nr2char(getchar()).

That was Vim 8.2.4106.

Today at work I updated my plugin and got an error, because getcharstr doesn't exist. This is Vim 8.2.1123.

When was getcharstr introduced? I had no luck in :help vim8, nor by grepping the repository (because I was grepping my fork which was not up-to-date, silly me).

Besides, is this information even available in a Vim installation (in the form of release notes or something)? Or how should I find it from the repository?

1 Answer 1

7

This was patch v8.2.2957, which can be found by examining a full clone of github.com/vim/vim and any of

# message search; fast enough I didn't need any of the other limiting options
git log -1 --grep getcharstr

but if it's not in the commit messages…

# patch search
# very slow
git log --oneline --reverse -Sgetcharstr | head -n1
# for example, limiting the range of versions to search from "bad" to "good"
git log --oneline --reverse -Sgetcharstr v8.2.1123..v8.2.4106 | head -n1
# knowing that the new function is in `runtime/doc/eval.txt`:
git log --oneline --reverse -Sgetcharstr v8.2.1123..v8.2.4106 -- runtime/doc/eval.txt | head -n1
# this might be the fastest patch search, knowing it's likely to be in `src/getchar.c`:
git log --oneline --reverse -Sgetcharstr v8.2.1123..v8.2.4106 -- src/getchar.c | head -n1
3
  • IS there any way to learn this without having a full clone of the source?
    – mcwayliffe
    Feb 9, 2022 at 18:12
  • 2
    I'm not aware of one in general. The list of patches in :help vim8 is sorely out of date. But you can always test for existence with has and exists
    – D. Ben Knoble
    Feb 9, 2022 at 18:41
  • 2
    @mcwayliffe there is a plugin github.com/tweekmonster/helpful.vim which gives the command :HelpfulVersion getcharstr, that shows the same version as this answer
    – Mass
    Feb 10, 2022 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.