diff options
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/quickfix.txt | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 982044c5b..293014b24 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1947,9 +1947,9 @@ under the current directory tree. The file path may need to be simplified to a common parent directory. The displayed text can be customized by setting the 'quickfixtextfunc' option -to a Vim function. This function will be called with a dict argument for -every entry in a quickfix or a location list. The dict argument will have the -following fields: +to a Vim function. This function will be called with a dict argument and +should return a List of strings to be displayed in the quickfix or location +list window. The dict argument will have the following fields: quickfix set to 1 when called for a quickfix list and 0 when called for a location list. @@ -1957,12 +1957,14 @@ following fields: location list. For a quickfix list, set to 0. Can be used in getloclist() to get the location list entry. id quickfix or location list identifier - idx index of the entry in the quickfix or location list + start_idx index of the first entry for which text should be returned + end_idx index of the last entry for which text should be returned The function should return a single line of text to display in the quickfix -window for the entry identified by idx. The function can obtain information -about the current entry using the |getqflist()| function and specifying the -quickfix list identifier "id" and the entry index "idx". +window for each entry from start_idx to end_idx. The function can obtain +information about the entries using the |getqflist()| function and specifying +the quickfix list identifier "id". For a location list, getloclist() function +can be used with the 'winid' argument. If a quickfix or location list specific customization is needed, then the 'quickfixtextfunc' attribute of the list can be set using the |setqflist()| or @@ -1977,11 +1979,14 @@ Example: > call setqflist([], ' ', {'lines' : v:oldfiles, 'efm' : '%f', \ 'quickfixtextfunc' : 'QfOldFiles'}) func QfOldFiles(info) - " get information about the specific quickfix entry - let e = getqflist({'id' : a:info.id, 'idx' : a:info.idx, - \ 'items' : 1}).items[0] - " return the simplified file name - return fnamemodify(bufname(e.bufnr), ':p:.') + " get information about a range of quickfix entries + let items = getqflist({'id' : a:info.id, 'items' : 1}).items + let l = [] + for idx in range(a:info.start_idx - 1, a:info.end_idx - 1) + " use the simplified file name + call add(l, fnamemodify(bufname(items[idx].bufnr), ':p:.')) + endfor + return l endfunc < |