Mercurial > vim
comparison runtime/doc/quickfix.txt @ 15424:90c8ff9c19ee v8.1.0720
patch 8.1.0720: cannot easily change the current quickfx list index
commit https://github.com/vim/vim/commit/5b69c22fd2bf0c0d32aab90ee4c7ef74259d2c4c
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jan 11 14:50:06 2019 +0100
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 11 Jan 2019 15:00:08 +0100 |
parents | 97b40b4c6911 |
children | f0f06837a699 |
comparison
equal
deleted
inserted
replaced
15423:aabfc000d8a8 | 15424:90c8ff9c19ee |
---|---|
1 *quickfix.txt* For Vim version 8.1. Last change: 2018 Dec 27 | 1 *quickfix.txt* For Vim version 8.1. Last change: 2019 Jan 09 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
54 *location-list* *E776* | 54 *location-list* *E776* |
55 A location list is a window-local quickfix list. You get one after commands | 55 A location list is a window-local quickfix list. You get one after commands |
56 like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a | 56 like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a |
57 location list instead of a quickfix list as the corresponding `:vimgrep`, | 57 location list instead of a quickfix list as the corresponding `:vimgrep`, |
58 `:grep`, `:helpgrep`, `:make` do. | 58 `:grep`, `:helpgrep`, `:make` do. |
59 *location-list-file-window* | |
59 A location list is associated with a window and each window can have a | 60 A location list is associated with a window and each window can have a |
60 separate location list. A location list can be associated with only one | 61 separate location list. A location list can be associated with only one |
61 window. The location list is independent of the quickfix list. | 62 window. The location list is independent of the quickfix list. |
62 | 63 |
63 When a window with a location list is split, the new window gets a copy of the | 64 When a window with a location list is split, the new window gets a copy of the |
361 modify the title of a quickfix and location list respectively. Examples: > | 362 modify the title of a quickfix and location list respectively. Examples: > |
362 call setqflist([], 'a', {'title' : 'Cmd output'}) | 363 call setqflist([], 'a', {'title' : 'Cmd output'}) |
363 echo getqflist({'title' : 1}) | 364 echo getqflist({'title' : 1}) |
364 call setloclist(3, [], 'a', {'title' : 'Cmd output'}) | 365 call setloclist(3, [], 'a', {'title' : 'Cmd output'}) |
365 echo getloclist(3, {'title' : 1}) | 366 echo getloclist(3, {'title' : 1}) |
367 < | |
368 *quickfix-index* | |
369 When you jump to a quickfix/location list entry using any of the quickfix | |
370 commands (e.g. |cc|, |cnext|, |cprev|, etc.), that entry becomes the currently | |
371 selected entry. The index of the currently selected entry in a | |
372 quickfix/location list can be obtained using the getqflist()/getloclist() | |
373 functions. Examples: > | |
374 echo getqflist({'idx' : 0}).idx | |
375 echo getqflist({'id' : qfid, 'idx' : 0}).idx | |
376 echo getloclist(2, {'idx' : 0}).idx | |
377 < | |
378 For a new quickfix list, the first entry is selected and the index is 1. Any | |
379 entry in any quickfix/location list can be set as the currently selected entry | |
380 using the setqflist() function. Examples: > | |
381 call setqflist([], 'a', {'idx' : 12}) | |
382 call setqflist([], 'a', {'id' : qfid, 'idx' : 7}) | |
383 call setloclist(1, [], 'a', {'idx' : 7}) | |
366 < | 384 < |
367 *quickfix-size* | 385 *quickfix-size* |
368 You can get the number of entries (size) in a quickfix and a location list | 386 You can get the number of entries (size) in a quickfix and a location list |
369 using the |getqflist()| and |getloclist()| functions respectively. Examples: > | 387 using the |getqflist()| and |getloclist()| functions respectively. Examples: > |
370 echo getqflist({'size' : 1}) | 388 echo getqflist({'size' : 1}) |
655 " get the context of the current location list | 673 " get the context of the current location list |
656 :echo getloclist(0, {'context' : 0}).context | 674 :echo getloclist(0, {'context' : 0}).context |
657 | 675 |
658 " get the location list window id of the third window | 676 " get the location list window id of the third window |
659 :echo getloclist(3, {'winid' : 0}).winid | 677 :echo getloclist(3, {'winid' : 0}).winid |
678 | |
679 " get the file window id of a location list window (winnr: 4) | |
680 :echo getloclist(4, {'filewinid' : 0}).filewinid | |
660 < | 681 < |
661 *setqflist-examples* | 682 *setqflist-examples* |
662 The |setqflist()| and |setloclist()| functions can be used to set the various | 683 The |setqflist()| and |setloclist()| functions can be used to set the various |
663 attributes of a quickfix and location list respectively. Some examples for | 684 attributes of a quickfix and location list respectively. Some examples for |
664 using these functions are below: | 685 using these functions are below: |
668 :let c = {'cmd' : 'grep'} | 689 :let c = {'cmd' : 'grep'} |
669 :call setqflist([], ' ', {'title' : t, 'context' : c}) | 690 :call setqflist([], ' ', {'title' : t, 'context' : c}) |
670 | 691 |
671 " set the title of the current quickfix list | 692 " set the title of the current quickfix list |
672 :call setqflist([], 'a', {'title' : 'Mytitle'}) | 693 :call setqflist([], 'a', {'title' : 'Mytitle'}) |
694 | |
695 " change the current entry in the list specified by an identifier | |
696 :call setqflist([], 'a', {'id' : qfid, 'idx' : 10}) | |
673 | 697 |
674 " set the context of a quickfix list specified by an identifier | 698 " set the context of a quickfix list specified by an identifier |
675 :call setqflist([], 'a', {'id' : qfid, 'context' : {'val' : 100}}) | 699 :call setqflist([], 'a', {'id' : qfid, 'context' : {'val' : 100}}) |
676 | 700 |
677 " create a new quickfix list from a command output | 701 " create a new quickfix list from a command output |
1549 :set mp=make\ \\\|&\ error_filter | 1573 :set mp=make\ \\\|&\ error_filter |
1550 The backslashes before the pipe character are required to avoid it to be | 1574 The backslashes before the pipe character are required to avoid it to be |
1551 recognized as a command separator. The backslash before each space is | 1575 recognized as a command separator. The backslash before each space is |
1552 required for the set command. | 1576 required for the set command. |
1553 | 1577 |
1554 *cfilter-plugin* *:Cfilter* *:Lfilter* | 1578 *cfilter-plugin* *:Cfilter* *:Lfilter* |
1555 If you have too many matching messages, you can use the cfilter plugin to | 1579 If you have too many matching messages, you can use the cfilter plugin to |
1556 reduce the number of entries. Load the plugin with: > | 1580 reduce the number of entries. Load the plugin with: > |
1557 packadd cfilter | 1581 packadd cfilter |
1558 | 1582 |
1559 Then you can use these command: > | 1583 Then you can use these command: > |