From 9111a210a3dfb011af44a2dcc10010718ebde346 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 17 Jun 2023 14:35:22 +0800 Subject: [PATCH] fix(flygrep): put filter context into flygrep buffer --- lua/spacevim/plugin/flygrep.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/spacevim/plugin/flygrep.lua b/lua/spacevim/plugin/flygrep.lua index 020ab2d1a..fa372c2b3 100644 --- a/lua/spacevim/plugin/flygrep.lua +++ b/lua/spacevim/plugin/flygrep.lua @@ -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)