%f item in getqflist()

12 views
Skip to first unread message

Lifepillar

unread,
Apr 25, 2022, 5:07:47 AM4/25/22
to vim...@googlegroups.com
I am looking into parsing a list of strings with an errorformat to
create a quicklist or location list out of it. Currently, I am doing it
as follows:

let efm = "%f:%l:%m"
let what = getqflist({"lines": ["foo:3:bar"], "efm": efm})
call setloclist(0, what.items)
echo what.items[0]

This sets the quickfix list as expected (is there a better way?). But
when I look at `what.items[0]`, I cannot find an item corresponding to
%f (`foo` in the example). Yet setloclist() sets it. Where is that
information stored?

Thanks,
Life.

Lifepillar

unread,
Apr 25, 2022, 5:46:19 AM4/25/22
to vim...@googlegroups.com
Ah, I see: you get the filename from the buffer's number. A new buffer
is created for `foo` is one does not already exist. And when no filename
is parsed from the errorformat, bufnr is 0. Neat!

Life.

Reply all
Reply to author
Forward
0 new messages