1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:30:04 +08:00

fix(flygrep): put filter context into flygrep buffer

This commit is contained in:
wsdjeg 2023-06-17 14:35:22 +08:00
parent dcbc0b34b8
commit 9111a210a3

View File

@ -496,6 +496,11 @@ local function filter(expr)
mpt._build_prompt()
pcall(vim.fn.matchdelete, filter_hi_id)
if expr == '' then
-- if the mpt is empty, put context in filter_file into flygrep buffer
if vim.fn.filereadable(filter_file) then
vim.api.nvim_buf_set_lines(buffer_id, 0, -1, false, vim.fn.readfile(filter_file, ''))
vim.cmd('redraw')
end
return
end
filter_hi_id = matchadd('FlygrepFilterPattern', expr_to_pattern(expr), 2)