Saturday, October 21, 2023

Re: Location list entries for unsaved buffer open a new buffer

On 2023-10-21, Yegappan Lakshmanan <yegappanl@gmail.com> wrote:
> On Sat, Oct 21, 2023 at 7:09 AM Lifepillar <lifepillar@lifepillar.me> wrote:
>> How do I generate location list entries that refer to the proper unsaved
>> buffer?
>>
>>
> There is a item in the todo list for more than 20 years now for this:
>
> - Add %b to 'errorformat': buffer number. (Yegappan Lakshmanan / Suresh
> Govindachar)

:-) I have found the following workaround: I pass the buffer number to
the callback, then I iterate over each parsed line and manually set the
buffer:

def Callback(channel: channel, msg: string, bufnr: number, ...)
[...]
var what = getqflist({"lines": [msg], "efm": efm})

for item in what.items
item["bufnr"] = bufnr
endfor

setloclist(winid, what.items, "a")
enddef

Life.

--
--
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/uh10ir%24u9l%241%40ciao.gmane.io.

No comments: