feat(actions): add quickfix list autocmd event exec (#2672)
Add `QuickFixCmdPre` and `QuickFixCmdPost` event triggers to `send_selected_to_qf` and `send_all_to_qf`
This commit is contained in:
@@ -889,6 +889,7 @@ local send_selected_to_qf = function(prompt_bufnr, mode, target)
|
||||
local prompt = picker:_get_prompt()
|
||||
actions.close(prompt_bufnr)
|
||||
|
||||
vim.api.nvim_exec_autocmds("QuickFixCmdPre", {})
|
||||
if target == "loclist" then
|
||||
vim.fn.setloclist(picker.original_win_id, qf_entries, mode)
|
||||
else
|
||||
@@ -896,6 +897,7 @@ local send_selected_to_qf = function(prompt_bufnr, mode, target)
|
||||
vim.fn.setqflist(qf_entries, mode)
|
||||
vim.fn.setqflist({}, "a", { title = qf_title })
|
||||
end
|
||||
vim.api.nvim_exec_autocmds("QuickFixCmdPost", {})
|
||||
end
|
||||
|
||||
local send_all_to_qf = function(prompt_bufnr, mode, target)
|
||||
@@ -910,6 +912,7 @@ local send_all_to_qf = function(prompt_bufnr, mode, target)
|
||||
local prompt = picker:_get_prompt()
|
||||
actions.close(prompt_bufnr)
|
||||
|
||||
vim.api.nvim_exec_autocmds("QuickFixCmdPre", {})
|
||||
if target == "loclist" then
|
||||
vim.fn.setloclist(picker.original_win_id, qf_entries, mode)
|
||||
else
|
||||
@@ -917,6 +920,7 @@ local send_all_to_qf = function(prompt_bufnr, mode, target)
|
||||
local qf_title = string.format([[%s (%s)]], picker.prompt_title, prompt)
|
||||
vim.fn.setqflist({}, "a", { title = qf_title })
|
||||
end
|
||||
vim.api.nvim_exec_autocmds("QuickFixCmdPost", {})
|
||||
end
|
||||
|
||||
--- Sends the selected entries to the quickfix list, replacing the previous entries.
|
||||
|
||||
Reference in New Issue
Block a user