diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-28 22:58:02 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-28 22:58:02 +0200 |
commit | fc65cabb15d0236bce001ad78e12a40511caf941 (patch) | |
tree | 071cd16ce17e02121ac1c7db7c7518cc70f10a79 /runtime/pack | |
parent | 627cb6a6b37d17433fe2d7df1f287eefb5b370e3 (diff) | |
download | vim-git-fc65cabb15d0236bce001ad78e12a40511caf941.tar.gz |
Update runtime files.
Diffstat (limited to 'runtime/pack')
-rw-r--r-- | runtime/pack/dist/opt/cfilter/plugin/cfilter.vim | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim b/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim index 7a6464fc9..fe4455fe2 100644 --- a/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim +++ b/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim @@ -1,15 +1,17 @@ " 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 +" Last Change: Aug 23, 2018 +" Maintainer: Yegappan Lakshmanan (yegappan AT yahoo DOT com) +" Version: 1.1 " " Commands to filter the quickfix list: -" :Cfilter[!] {pat} +" :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} +" {pat} are used. The pattern can be optionally enclosed using one of +" the following characters: ', ", /. If the pattern is empty, then the +" last used search pattern is used. +" :Lfilter[!] /{pat}/ " Same as :Cfilter but operates on the current location list. " if exists("loaded_cfilter") @@ -17,7 +19,7 @@ if exists("loaded_cfilter") endif let loaded_cfilter = 1 -func s:Qf_filter(qf, pat, bang) +func s:Qf_filter(qf, searchpat, bang) if a:qf let Xgetlist = function('getqflist') let Xsetlist = function('setqflist') @@ -28,14 +30,31 @@ func s:Qf_filter(qf, pat, bang) let cmd = ':Lfilter' . a:bang endif + let firstchar = a:searchpat[0] + let lastchar = a:searchpat[-1:] + if firstchar == lastchar && + \ (firstchar == '/' || firstchar == '"' || firstchar == "'") + let pat = a:searchpat[1:-2] + if pat == '' + " Use the last search pattern + let pat = @/ + endif + else + let pat = a:searchpat + endif + + if pat == '' + return + endif + if a:bang == '!' - let cond = 'v:val.text !~# a:pat && bufname(v:val.bufnr) !~# a:pat' + let cond = 'v:val.text !~# pat && bufname(v:val.bufnr) !~# pat' else - let cond = 'v:val.text =~# a:pat || bufname(v:val.bufnr) =~# a:pat' + let cond = 'v:val.text =~# pat || bufname(v:val.bufnr) =~# pat' endif let items = filter(Xgetlist(), cond) - let title = cmd . ' ' . a:pat + let title = cmd . ' /' . pat . '/' call Xsetlist([], ' ', {'title' : title, 'items' : items}) endfunc |