From 7bb4973246f4dc38e2b0375607df9668c4efb282 Mon Sep 17 00:00:00 2001 From: bhagwan Date: Tue, 14 Jun 2022 17:35:27 -0700 Subject: [PATCH] chore(grep): rename opt 'continue_last_search' -> 'resume' --- lua/fzf-lua/actions.lua | 4 ++-- lua/fzf-lua/config.lua | 9 +++++++++ lua/fzf-lua/core.lua | 2 +- lua/fzf-lua/providers/grep.lua | 20 ++++++-------------- lua/fzf-lua/providers/lsp.lua | 4 +--- lua/fzf-lua/providers/tags.lua | 5 ++--- 6 files changed, 21 insertions(+), 23 deletions(-) diff --git a/lua/fzf-lua/actions.lua b/lua/fzf-lua/actions.lua index b974610..b939bc7 100644 --- a/lua/fzf-lua/actions.lua +++ b/lua/fzf-lua/actions.lua @@ -588,8 +588,8 @@ M.grep_lgrep = function(_, opts) local o = vim.tbl_extend("keep", { search = false, - continue_last_search = true, - continue_last_search_default = '', + resume = true, + resume_search_default = '', rg_glob = opts.rg_glob or opts.__call_opts.rg_glob, -- globs always require command processing with 'multiprocess' requires_processing = opts.rg_glob or opts.__call_opts.rg_glob, diff --git a/lua/fzf-lua/config.lua b/lua/fzf-lua/config.lua index 80c6029..a7758bc 100644 --- a/lua/fzf-lua/config.lua +++ b/lua/fzf-lua/config.lua @@ -744,6 +744,15 @@ function M.normalize_opts(opts, defaults) opts.global_resume = get_opt('global_resume', opts, M.globals) opts.global_resume_query = get_opt('global_resume_query', opts, M.globals) + -- Backward compat: renamed '{continue|repeat}_last_search' + if opts.resume == nil then + for _, o in ipairs({ 'repeat_last_search', 'continue_last_search' }) do + if opts[o] ~= nil then + opts.resume = opts[o] + end + end + end + -- global option overrides, if exists, these options will -- be used in a "LOGICAL AND" against the local option (#188) -- e.g.: diff --git a/lua/fzf-lua/core.lua b/lua/fzf-lua/core.lua index 8cb27d8..5ff0bb5 100644 --- a/lua/fzf-lua/core.lua +++ b/lua/fzf-lua/core.lua @@ -31,7 +31,7 @@ M.fzf_resume = function(opts) opts.cmd = nil opts.query = nil opts.search = nil - opts.continue_last_search = true + opts.resume = true opts.__FNCREF__(opts) else opts.fzf_opts['--query'] = last_query diff --git a/lua/fzf-lua/providers/grep.lua b/lua/fzf-lua/providers/grep.lua index af3f5c5..e902523 100644 --- a/lua/fzf-lua/providers/grep.lua +++ b/lua/fzf-lua/providers/grep.lua @@ -115,10 +115,9 @@ M.grep = function(opts) opts.__MODULE__ = opts.__MODULE__ or M local no_esc = false - if not opts.search and - (opts.continue_last_search or opts.repeat_last_search) then + if not opts.search and opts.resume then opts.search, no_esc = get_last_search(opts) - opts.search = opts.search or opts.continue_last_search_default + opts.search = opts.search or opts.resume_search_default end -- if user did not provide a search term @@ -181,8 +180,7 @@ M.live_grep_st = function(opts) assert(not opts.multiprocess) local no_esc = false - if not opts.search and - (opts.continue_last_search or opts.repeat_last_search) then + if not opts.search and opts.resume then opts.search, no_esc = get_last_search(opts) end @@ -262,8 +260,7 @@ M.live_grep_mt = function(opts) assert(opts.multiprocess) local no_esc = false - if not opts.search and - (opts.continue_last_search or opts.repeat_last_search) then + if not opts.search and opts.resume then opts.search, no_esc = get_last_search(opts) end @@ -445,18 +442,13 @@ end M.live_grep_resume = function(opts) if not opts then opts = {} end - if not opts.search then - opts.continue_last_search = - (opts.continue_last_search == nil and - opts.repeat_last_search == nil and true) or - (opts.continue_last_search or opts.repeat_last_search) - end + opts.resume = true return M.live_grep(opts) end M.grep_last = function(opts) if not opts then opts = {} end - opts.continue_last_search = true + opts.resume = true return M.grep(opts) end diff --git a/lua/fzf-lua/providers/lsp.lua b/lua/fzf-lua/providers/lsp.lua index ba30ee4..8814ead 100644 --- a/lua/fzf-lua/providers/lsp.lua +++ b/lua/fzf-lua/providers/lsp.lua @@ -814,9 +814,7 @@ M.live_workspace_symbols = function(opts) opts.exec_empty_query = true end - if not opts.query - and opts.continue_last_search ~= false - and opts.repeat_last_search ~= false then + if not opts.query and opts.resume then opts.query = last_search.query end diff --git a/lua/fzf-lua/providers/tags.lua b/lua/fzf-lua/providers/tags.lua index 800fd54..e07c6be 100644 --- a/lua/fzf-lua/providers/tags.lua +++ b/lua/fzf-lua/providers/tags.lua @@ -143,10 +143,9 @@ end M.grep = function(opts) opts = opts or {} - if not opts.search and - (opts.continue_last_search or opts.repeat_last_search) then + if not opts.search and opts.resume then opts.search, opts.no_esc = M.get_last_search(opts) - opts.search = opts.search or opts.continue_last_search_default + opts.search = opts.search or opts.resume_search_default end if not opts.search then