chore(grep): rename opt 'continue_last_search' -> 'resume'

main
bhagwan 2 years ago
parent ae99fed33f
commit 7bb4973246

@ -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,

@ -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.:

@ -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

@ -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

@ -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

@ -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

Loading…
Cancel
Save