diff --git a/bundle/flygrep.nvim/README.md b/bundle/flygrep.nvim/README.md index 14ab945d7..69ac01d01 100644 --- a/bundle/flygrep.nvim/README.md +++ b/bundle/flygrep.nvim/README.md @@ -96,6 +96,7 @@ require('flygrep').setup({ | `` | open item in vertical split window | | `` | open item in new tabpage | | `` | toggle preview window | +| `` | toggle display hidden files | ## Feedback diff --git a/bundle/flygrep.nvim/lua/flygrep.lua b/bundle/flygrep.nvim/lua/flygrep.lua index 5727f1c79..9d6644e8c 100644 --- a/bundle/flygrep.nvim/lua/flygrep.lua +++ b/bundle/flygrep.nvim/lua/flygrep.lua @@ -20,6 +20,7 @@ local grep_input = '' local search_jobid = -1 local search_hi_id = -1 local fix_string = false +local include_hidden_file = false -- all buffers local result_bufid = -1 @@ -48,6 +49,9 @@ local function build_grep_command() for _, v in ipairs(conf.command.default_opts) do table.insert(cmd, v) end + if include_hidden_file then + table.insert(cmd, conf.command.hidden_opt) + end if fix_string then table.insert(cmd, conf.command.fixed_string_opt) else @@ -143,6 +147,11 @@ local function build_prompt_title() return t end +local function toggle_hidden_file() + include_hidden_file = not include_hidden_file + vim.cmd('doautocmd TextChangedI') +end + local function toggle_fix_string() fix_string = not fix_string vim.cmd('doautocmd TextChangedI') @@ -416,6 +425,10 @@ local function open_win() toggle_fix_string() update_result_count() end, { buffer = prompt_bufid }) + vim.keymap.set('i', '', function() + toggle_hidden_file() + update_result_count() + end, { buffer = prompt_bufid }) vim.keymap.set('i', '', function() toggle_preview_win() end, { buffer = prompt_bufid })