[vim/vim] Change v:errmsg type from string to list<string> (Issue #19345)

7 views
Skip to first unread message

ubaldot

unread,
Feb 6, 2026, 6:49:03 AM (2 days ago) Feb 6
to vim/vim, Subscribed
ubaldot created an issue (vim/vim#19345)

Sometimes, while developing scripts/plugins you have a chain of errors error1->error2->error3 but ´v:errmsg` only store the last error.

It would be handy to change the type of v:errmsg from string to list<string>, along the line of v:errors which is already a list<string>. It would be even better if the stored information contains the filename and the line where the errors occurred.

As alternative, one could read :messages but that is not so handy when it comes to automate tasks.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19345@github.com>

Shougo

unread,
Feb 6, 2026, 7:22:07 PM (2 days ago) Feb 6
to vim/vim, Subscribed
Shougo left a comment (vim/vim#19345)

It seems good, but it is not backward compatible.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19345/3863120049@github.com>

Phạm Bình An

unread,
Feb 7, 2026, 9:56:33 AM (yesterday) Feb 7
to vim/vim, Subscribed
brianhuster left a comment (vim/vim#19345)

Btw errmsg is singular, while errors is plural. So the request doesn't make sense grammartically. I think there should be a new variable instead


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19345/3864648382@github.com>

Christian Brabandt

unread,
3:56 AM (7 hours ago) 3:56 AM
to vim/vim, Subscribed

Closed #19345 as not planned.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/19345/issue_event/22620708923@github.com>

Christian Brabandt

unread,
3:56 AM (7 hours ago) 3:56 AM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19345)

This is not backwards compatible.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19345/3866559503@github.com>

ubaldot

unread,
4:12 AM (7 hours ago) 4:12 AM
to vim/vim, Subscribed
ubaldot left a comment (vim/vim#19345)

What about adding another variable as suggested then?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19345/3866611266@github.com>

Christian Brabandt

unread,
4:14 AM (7 hours ago) 4:14 AM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19345)

I am not a fan of adding another variable, it adds to the confusion, I already don't know when to use what. Is there a reason you cannot use v:errors then?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19345/3866621128@github.com>

Phạm Bình An

unread,
4:19 AM (7 hours ago) 4:19 AM
to vim/vim, Subscribed
brianhuster left a comment (vim/vim#19345)

Is there a reason you cannot use v:errors then?

I think they are fundamentally different. v:errors only save errors of assert_ functions. Maybe OP wants a variable that can save any error messages of the Vim session. This would be useful in testing plugin for example, if tests fail you may want to print all error messages possible to help debugging the problem.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19345/3866642923@github.com>

ubaldot

unread,
6:53 AM (4 hours ago) 6:53 AM
to vim/vim, Subscribed
ubaldot left a comment (vim/vim#19345)

I think they are fundamentally different. v:errors only save errors of assert_ functions. Maybe OP wants a variable that can save any error messages of the Vim session. This would be useful in testing plugin for example, if tests fail you may want to print all error messages possible to help debugging the problem.

This. Also, note that v:errors is a list (which makes lot of sense!) but it only logs assertion errors, whereas v:errmsg is a string and saves only the last error message. It is a weird design IMO but I can take that historically v:errmsg came before v:errors. I take a bit less that we won't improve it due to retro-compatibility. As it is now, as a workaround I am reading the list of all messages set by Vim from :messages but it is a very ugly workaround. And we have two error management systems with one logging into a list and one taking only the last error message (in reality there is a third based on thrown exception but we can safely skip it for now).

Regarding retro-compatibility, I think the change is not big, and those who finds their scripts broken can easily fix it.

Also, regarding retro-compatibility policy, it would be nice to have a clear policy.
For example:

#18066 <- this is a bug, but for keeping retro-compatibility has not been fixed
#19301 <- this issue were due to a bug that has been fixed (with good peace for retro-compatibility, in-fact I have been hit due to retro-compatibility break. And TBH I was perfectly fine with such a change)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19345/3867055404@github.com>

Reply all
Reply to author
Forward
0 new messages