From 5b69c22fd2bf0c0d32aab90ee4c7ef74259d2c4c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 11 Jan 2019 14:50:06 +0100 Subject: patch 8.1.0720: cannot easily change the current quickfx list index Problem: Cannot easily change the current quickfx list index. Solution: Add the "idx" argument to setqflist(). (Yegappan Lakshmanan, closes #3701) --- runtime/doc/quickfix.txt | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'runtime/doc/quickfix.txt') diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 471c5f96ec..18372dda0c 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1,4 +1,4 @@ -*quickfix.txt* For Vim version 8.1. Last change: 2018 Dec 27 +*quickfix.txt* For Vim version 8.1. Last change: 2019 Jan 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -56,6 +56,7 @@ A location list is a window-local quickfix list. You get one after commands like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a location list instead of a quickfix list as the corresponding `:vimgrep`, `:grep`, `:helpgrep`, `:make` do. + *location-list-file-window* A location list is associated with a window and each window can have a separate location list. A location list can be associated with only one window. The location list is independent of the quickfix list. @@ -363,6 +364,23 @@ modify the title of a quickfix and location list respectively. Examples: > echo getqflist({'title' : 1}) call setloclist(3, [], 'a', {'title' : 'Cmd output'}) echo getloclist(3, {'title' : 1}) +< + *quickfix-index* +When you jump to a quickfix/location list entry using any of the quickfix +commands (e.g. |cc|, |cnext|, |cprev|, etc.), that entry becomes the currently +selected entry. The index of the currently selected entry in a +quickfix/location list can be obtained using the getqflist()/getloclist() +functions. Examples: > + echo getqflist({'idx' : 0}).idx + echo getqflist({'id' : qfid, 'idx' : 0}).idx + echo getloclist(2, {'idx' : 0}).idx +< +For a new quickfix list, the first entry is selected and the index is 1. Any +entry in any quickfix/location list can be set as the currently selected entry +using the setqflist() function. Examples: > + call setqflist([], 'a', {'idx' : 12}) + call setqflist([], 'a', {'id' : qfid, 'idx' : 7}) + call setloclist(1, [], 'a', {'idx' : 7}) < *quickfix-size* You can get the number of entries (size) in a quickfix and a location list @@ -657,6 +675,9 @@ using these functions are below: " get the location list window id of the third window :echo getloclist(3, {'winid' : 0}).winid + + " get the file window id of a location list window (winnr: 4) + :echo getloclist(4, {'filewinid' : 0}).filewinid < *setqflist-examples* The |setqflist()| and |setloclist()| functions can be used to set the various @@ -671,6 +692,9 @@ using these functions are below: " set the title of the current quickfix list :call setqflist([], 'a', {'title' : 'Mytitle'}) + " change the current entry in the list specified by an identifier + :call setqflist([], 'a', {'id' : qfid, 'idx' : 10}) + " set the context of a quickfix list specified by an identifier :call setqflist([], 'a', {'id' : qfid, 'context' : {'val' : 100}}) @@ -1551,7 +1575,7 @@ The backslashes before the pipe character are required to avoid it to be recognized as a command separator. The backslash before each space is required for the set command. - *cfilter-plugin* *:Cfilter* *:Lfilter* + *cfilter-plugin* *:Cfilter* *:Lfilter* If you have too many matching messages, you can use the cfilter plugin to reduce the number of entries. Load the plugin with: > packadd cfilter -- cgit v1.2.3