import { fn } from "https://deno.land/x/ddc_vim@v4.0.2/deps.ts";
const { getqflist } = fn;
Returns a List
with all the current quickfix errors. Each
list item is a dictionary with these entries:
bufnr number of buffer that has the file name, use
bufname() to get the name
module module name
lnum line number in the buffer (first line is 1)
end_lnum
end of line number if the item is multiline
col column number (first column is 1)
end_col end of column number if the item has range
vcol TRUE
: "col" is visual column
FALSE
: "col" is byte index
nr error number
pattern search pattern used to locate the error
text description of the error
type type of the error, 'E', '1', etc.
valid TRUE
: recognized error message
When there is no error list or it's empty, an empty list is returned. Quickfix list entries with a non-existing buffer number are returned with "bufnr" set to zero (Note: some functions accept buffer number zero for the alternate buffer, you may need to explicitly check for zero).
Useful application: Find pattern matches in multiple files and do something with them:
:vimgrep /theword/jg *.c
:for d in getqflist()
: echo bufname(d.bufnr) ':' d.lnum '=' d.text
:endfor
If the optional {what} dictionary argument is supplied, then
returns only the items listed in {what} as a dictionary. The
following string items are supported in {what}:
changedtick get the total number of changes made
to the list quickfix-changedtick
context get the quickfix-context
efm errorformat to use when parsing "lines". If
not present, then the 'errorformat' option
value is used.
id get information for the quickfix list with
quickfix-ID
; zero means the id for the
current list or the list specified by "nr"
idx get information for the quickfix entry at this
index in the list specified by 'id' or 'nr'.
If set to zero, then uses the current entry.
See quickfix-index
items quickfix list entries
lines parse a list of lines using 'efm' and return
the resulting entries. Only a List
type is
accepted. The current quickfix list is not
modified. See quickfix-parse
.
nr get information for this quickfix list; zero
means the current quickfix list and "$" means
the last quickfix list
qfbufnr number of the buffer displayed in the quickfix
window. Returns 0 if the quickfix buffer is
not present. See quickfix-buffer
.
size number of entries in the quickfix list
title get the list title quickfix-title
winid get the quickfix window-ID
all all of the above quickfix properties
Non-string items in {what} are ignored. To get the value of a
particular item, set it to zero.
If "nr" is not present then the current quickfix list is used.
If both "nr" and a non-zero "id" are specified, then the list
specified by "id" is used.
To get the number of lists in the quickfix stack, set "nr" to
"$" in {what}. The "nr" value in the returned dictionary
contains the quickfix stack size.
When "lines" is specified, all the other items except "efm"
are ignored. The returned dictionary contains the entry
"items" with the list of entries.
The returned dictionary contains the following entries:
changedtick total number of changes made to the
list quickfix-changedtick
context quickfix list context. See quickfix-context
If not present, set to "".
id quickfix list ID quickfix-ID
. If not
present, set to 0.
idx index of the quickfix entry in the list. If not
present, set to 0.
items quickfix list entries. If not present, set to
an empty list.
nr quickfix list number. If not present, set to 0
qfbufnr number of the buffer displayed in the quickfix
window. If not present, set to 0.
size number of entries in the quickfix list. If not
present, set to 0.
title quickfix list title text. If not present, set
to "".
winid quickfix window-ID
. If not present, set to 0
Examples (See also getqflist-examples
):
:echo getqflist({'all': 1})
:echo getqflist({'nr': 2, 'title': 1})
:echo getqflist({'lines' : ["F1:10:L10"]})