To: vim_dev@googlegroups.com Subject: Patch 8.1.0311 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0311 Problem: Filtering entries in a quickfix list is not easy. Solution: Add the cfilter plugin. (Yegappan Lakshmanan) Files: runtime/pack/dist/opt/cfilter/plugin/cfilter.vim, runtime/doc/quickfix.txt *** ../vim-8.1.0310/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim 1970-01-01 01:00:00.000000000 +0100 --- runtime/pack/dist/opt/cfilter/plugin/cfilter.vim 2018-08-21 18:56:37.027118962 +0200 *************** *** 0 **** --- 1,43 ---- + " cfilter.vim: Plugin to filter entries from a quickfix/location list + " Last Change: May 12, 2018 + " Maintainer: Yegappan Lakshmanan (yegappan AT yahoo DOT com) + " Version: 1.0 + " + " Commands to filter the quickfix list: + " :Cfilter[!] {pat} + " Create a new quickfix list from entries matching {pat} in the current + " quickfix list. Both the file name and the text of the entries are + " matched against {pat}. If ! is supplied, then entries not matching + " {pat} are used. + " :Lfilter[!] {pat} + " Same as :Cfilter but operates on the current location list. + " + if exists("loaded_cfilter") + finish + endif + let loaded_cfilter = 1 + + func s:Qf_filter(qf, pat, bang) + if a:qf + let Xgetlist = function('getqflist') + let Xsetlist = function('setqflist') + let cmd = ':Cfilter' . a:bang + else + let Xgetlist = function('getloclist', [0]) + let Xsetlist = function('setloclist', [0]) + let cmd = ':Lfilter' . a:bang + endif + + if a:bang == '!' + let cond = 'v:val.text !~# a:pat && bufname(v:val.bufnr) !~# a:pat' + else + let cond = 'v:val.text =~# a:pat || bufname(v:val.bufnr) =~# a:pat' + endif + + let items = filter(Xgetlist(), cond) + let title = cmd . ' ' . a:pat + call Xsetlist([], ' ', {'title' : title, 'items' : items}) + endfunc + + com! -nargs=+ -bang Cfilter call s:Qf_filter(1, , ) + com! -nargs=+ -bang Lfilter call s:Qf_filter(0, , ) *** ../vim-8.1.0310/runtime/doc/quickfix.txt 2018-07-08 18:20:18.111521913 +0200 --- runtime/doc/quickfix.txt 2018-08-21 19:02:00.097112470 +0200 *************** *** 1551,1556 **** --- 1551,1572 ---- recognized as a command separator. The backslash before each space is required for the set command. + *cfilter-plugin* + 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 + + Then you can use these command: > + :Cfilter[!] {pat} + :Lfilter[!] {pat} + + :Cfilter creates a new quickfix list from entries matching {pat} in the + current quickfix list. Both the file name and the text of the entries are + matched against {pat}. If ! is supplied, then entries not matching {pat} are + used. + + :Lfilter does the same as :Cfilter but operates on the current location list. + ============================================================================= 8. The directory stack *quickfix-directory-stack* *** ../vim-8.1.0310/src/version.c 2018-08-21 18:50:11.153501902 +0200 --- src/version.c 2018-08-21 19:01:28.421309486 +0200 *************** *** 796,797 **** --- 796,799 ---- { /* Add new patch number below this line */ + /**/ + 311, /**/ -- ARTHUR: Be quiet! I order you to shut up. OLD WOMAN: Order, eh -- who does he think he is? ARTHUR: I am your king! OLD WOMAN: Well, I didn't vote for you. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///