Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] This is a first attempt at modernising this plugin. #118

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Syntax
  • Loading branch information
Romain Lafourcade committed May 28, 2021
commit db53f013c566f910037f9ba3169a3abd3488056b
18 changes: 9 additions & 9 deletions autoload/qf/filter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ function! s:FilteredList(list, pat, range, reject, strategy)

" bufname && text
if a:strategy == 0
let new_list = a:list->filter("(bufname(v:val['bufnr']) . v:val['text'] " . operator . " a:pat)")
let new_list = a:list->filter("(bufname(v:val['bufnr']) .. v:val['text'] " .. operator .. " a:pat)")
endif

" only bufname
if a:strategy == 1
let new_list = a:list->filter("bufname(v:val['bufnr']) " . operator . " a:pat")
let new_list = a:list->filter("bufname(v:val['bufnr']) " .. operator .. " a:pat")
endif

" only text
if a:strategy == 2
let new_list = a:list->filter("v:val['text'] " . operator . " a:pat")
let new_list = a:list->filter("v:val['text'] " .. operator .. " a:pat")
endif

" range
Expand Down Expand Up @@ -76,9 +76,9 @@ function! s:AddList()

if qf#IsQfWindow()
if exists("g:qf_quickfix_lists")
let g:qf_quickfix_lists = add(g:qf_quickfix_lists, getqflist())
let g:qf_quickfix_lists = add(g:qf_quickfix_lists, qf#GetListItems())
else
let g:qf_quickfix_lists = [getqflist()]
let g:qf_quickfix_lists = [qf#GetListItems()]
endif
endif
endfunction
Expand All @@ -100,16 +100,16 @@ function! s:SetTitle(pat, range, reject)

" describe the filter that was applied
if a:pat != ''
let filter = "'" . a:pat . "'"
let filter = "'" .. a:pat .. "'"
else
if a:range[0] == a:range[1]
let filter = "entry " . (a:range[0] + 1)
let filter = "entry " .. (a:range[0] + 1)
else
let filter = "entries " . (a:range[0] + 1) . ".." . (a:range[1] + 1)
let filter = "entries " .. (a:range[0] + 1) .. ".." .. (a:range[1] + 1)
endif
endif

let str = " [" . action . ": " . filter . "]"
let str = " [" .. action .. ": " .. filter .. "]"

if qf#IsLocWindow()
call s:SetTitleValue(winnr("#")->getwinvar("qf_location_titles")[0] .. str)
Expand Down