comparison runtime/doc/quickfix.txt @ 13818:28ac7914b2b6

Update runtime files and translations commit https://github.com/vim/vim/commit/15142e27aaafa15b72d1042c25fbb5e4f12b6736 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 30 22:19:58 2018 +0200 Update runtime files and translations
author Christian Brabandt <cb@256bit.org>
date Mon, 30 Apr 2018 22:30:08 +0200
parents 5923f64c8f5b
children 98274127d675
comparison
equal deleted inserted replaced
13817:49f764b1d6cc 13818:28ac7914b2b6
1 *quickfix.txt* For Vim version 8.0. Last change: 2018 Mar 29 1 *quickfix.txt* For Vim version 8.0. Last change: 2018 Apr 28
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
594 You can use the |getqflist()| and |getloclist()| functions to obtain the 594 You can use the |getqflist()| and |getloclist()| functions to obtain the
595 window ID of the quickfix window and location list window respectively (if 595 window ID of the quickfix window and location list window respectively (if
596 present). Examples: > 596 present). Examples: >
597 echo getqflist({'winid' : 1}).winid 597 echo getqflist({'winid' : 1}).winid
598 echo getloclist(2, {'winid' : 1}).winid 598 echo getloclist(2, {'winid' : 1}).winid
599 <
600 *getqflist-examples*
601 The getqflist() and getloclist() functions can be used to get the various
602 attributes of a quickfix and location list respectively. Some examples for
603 using these functions are below:
604 >
605 " get the title of the current quickfix list
606 :echo getqflist({'title' : 0}).title
607
608 " get the identifier of the current quickfix list
609 :let qfid = getqflist({'id' : 0}).id
610
611 " get the index of the current quickfix list in the stack
612 :let qfnum = getqflist({'nr' : 0}).nr
613
614 " get the items of a quickfix list specified by an identifier
615 :echo getqflist({'id' : qfid, 'items' : 0}).items
616
617 " get the number of entries in a quickfix list specified by an id
618 :echo getqflist({'id' : qfid, 'size' : 0}).size
619
620 " get the context of the third quickfix list in the stack
621 :echo getqflist({'nr' : 3, 'context' : 0}).context
622
623 " get the number of quickfix lists in the stack
624 :echo getqflist({'nr' : '$'}).nr
625
626 " get the number of times the current quickfix list is changed
627 :echo getqflist({'changedtick' : 0}).changedtick
628
629 " get the current entry in a quickfix list specified by an identifier
630 :echo getqflist({'id' : qfid, 'idx' : 0}).idx
631
632 " get all the quickfix list attributes using an identifier
633 :echo getqflist({'id' : qfid, 'all' : 0})
634
635 " parse text from a List of lines and return a quickfix list
636 :let myList = ["a.java:10:L10", "b.java:20:L20"]
637 :echo getqflist({'lines' : myList}).items
638
639 " parse text using a custom 'efm' and return a quickfix list
640 :echo getqflist({'lines' : ['a.c#10#Line 10'], 'efm':'%f#%l#%m'}).items
641
642 " get the quickfix list window id
643 :echo getqflist({'winid' : 0}).winid
644
645 " get the context of the current location list
646 :echo getloclist(0, {'context' : 0}).context
647
648 " get the location list window id of the third window
649 :echo getloclist(3, {'winid' : 0}).winid
650 <
651 *setqflist-examples*
652 The setqflist() and setloclist() functions can be used to set the various
653 attributes of a quickfix and location list respectively. Some examples for
654 using these functions are below:
655 >
656 " set the title of the current quickfix list
657 :call setqflist([], 'a', {'title' : 'Mytitle'})
658
659 " set the context of a quickfix list specified by an identifier
660 :call setqflist([], 'a', {'id' : qfid, 'context' : {'val' : 100}})
661
662 " create a new quickfix list from a command output
663 :call setqflist([], ' ', {'lines' : systemlist('grep -Hn main *.c')})
664
665 " parse text using a custom efm and add to a particular quickfix list
666 :call setqflist([], 'a', {'id' : qfid,
667 \ 'lines' : ["a.c#10#L10", "b.c#20#L20"], 'efm':'%f#%l#%m'})
668
669 " add items to the quickfix list specified by an identifier
670 :let newItems = [{'filename' : 'a.txt', 'lnum' : 10, 'text' : "Apple"},
671 \ {'filename' : 'b.txt', 'lnum' : 20, 'text' : "Orange"}]
672 :call setqflist([], 'a', {'id' : qfid, 'items' : newItems})
673
674 " free all the quickfix lists in the stack
675 :call setqflist([], 'f')
676
677 " set the title of the fourth quickfix list
678 :call setqflist([], 'a', {'nr' : 4, 'title' : 'SomeTitle'})
679
680 " create a new quickfix list at the end of the stack
681 :call setqflist([], ' ', {'nr' : '$',
682 \ 'lines' : systemlist('grep -Hn class *.java')})
683
684 " create a new location list from a command output
685 :call setloclist(0, [], ' ', {'lines' : systemlist('grep -Hn main *.c')})
686
687 " replace the location list entries for the third window
688 :call setloclist(3, [], 'r', {'items' : newItems})
599 < 689 <
600 ============================================================================= 690 =============================================================================
601 3. Using more than one list of errors *quickfix-error-lists* 691 3. Using more than one list of errors *quickfix-error-lists*
602 692
603 So far has been assumed that there is only one list of errors. Actually the 693 So far has been assumed that there is only one list of errors. Actually the