[vim/vim] The winid field in the info dictionary passed to the custom function specified by quickfixtextfunc is incorrect when lvimgrep is executed from within a user-defined function. (Issue #20632)

2 views
Skip to first unread message

Louis

unread,
Jun 24, 2026, 11:33:25 PM (10 hours ago) Jun 24
to vim/vim, Subscribed
louisliu0816 created an issue (vim/vim#20632)

Steps to reproduce

Since the Location List needs to be associated with a window, that is, the entries displayed in the Location List correspond to a specific window ID (referred to as the "business window"). In addition, the Location List itself also has a window ID (referred to as the "Location List window").

When the quickfixtextfunc option is set to a custom function:

When executing :lvimgrep directly via an Ex command, the window ID obtained via a:info.winid in the custom function is the ID of the business window (correct);

However, if the lvimgrep command is wrapped inside a custom function, a:info.winid shows the ID of the Location List window instead (incorrect).

Nevertheless, within the custom function specified by the quickfixtextfunc option, in order to obtain the contents of the Location List, the only way is to call the getloclist() function. However, this function requires the business window ID to be specified. Since the interface of the custom function is fixed (it only accepts a single dictionary parameter info) and is invoked automatically by Vim, this makes it impossible to obtain the correct business window ID, and consequently, the contents cannot be retrieved via getloclist().

A workaround solution is to use getwinvar() to check the &buftype attribute of that window. If it is quickfix, use the ID of its previous window (#); otherwise, use the current window ID.

if getwinvar(a:info.winid, '&buftype') == 'quickfix'
let file_winid = win_getid(winnr('#'))
else
let file_winid = a:info.winid
endif

Expected behaviour

In all cases, the winid in info should always return the associated "business window ID", rather than — as happens when lvimgrep is executed within a custom function — returning the ID of the Location List window itself.

Version of Vim

vim 9.1.821

Environment

window 11

Logs and stack traces


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20632@github.com>

zeertzjq

unread,
Jun 24, 2026, 11:43:16 PM (10 hours ago) Jun 24
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#20632)

Where are the "steps" in "Steps to reproduce"?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Reply all
Reply to author
Forward
0 new messages