summaryrefslogtreecommitdiffstats
path: root/runtime/doc/quickfix.txt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-11 19:35:52 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-11 19:35:52 +0200
commit00e260bb6cc33ff5dbba15ac87ca7fd465aa49c0 (patch)
tree26e20606b22b4725a8089506d2178a42bff3f177 /runtime/doc/quickfix.txt
parent1de5f7c81d5e78fb4d612134bd2dfa6ee9183fae (diff)
patch 8.2.0959: using 'quickfixtextfunc' is a bit slowv8.2.0959
Problem: Using 'quickfixtextfunc' is a bit slow. Solution: Process a list of entries. (Yegappan Lakshmanan, closes #6234)
Diffstat (limited to 'runtime/doc/quickfix.txt')
-rw-r--r--runtime/doc/quickfix.txt29
1 files changed, 17 insertions, 12 deletions
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index 982044c5bf..293014b240 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
<