mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 11:18:26 +00:00
feat(picker): added args
option for files
and grep
. Closes #621
This commit is contained in:
parent
c258a6ef87
commit
781b6f6ab0
3 changed files with 8 additions and 0 deletions
|
@ -119,6 +119,7 @@ M.diagnostics_buffer = {
|
||||||
---@field dirs? string[] directories to search
|
---@field dirs? string[] directories to search
|
||||||
---@field follow? boolean follow symlinks
|
---@field follow? boolean follow symlinks
|
||||||
---@field exclude? string[] exclude patterns
|
---@field exclude? string[] exclude patterns
|
||||||
|
---@field args? string[] additional arguments
|
||||||
M.files = {
|
M.files = {
|
||||||
finder = "files",
|
finder = "files",
|
||||||
format = "file",
|
format = "file",
|
||||||
|
@ -218,6 +219,7 @@ M.git_diff = {
|
||||||
---@field buffers? boolean search in open buffers
|
---@field buffers? boolean search in open buffers
|
||||||
---@field need_search? boolean require a search pattern
|
---@field need_search? boolean require a search pattern
|
||||||
---@field exclude? string[] exclude patterns
|
---@field exclude? string[] exclude patterns
|
||||||
|
---@field args? string[] additional arguments
|
||||||
M.grep = {
|
M.grep = {
|
||||||
finder = "grep",
|
finder = "grep",
|
||||||
format = "file",
|
format = "file",
|
||||||
|
|
|
@ -60,6 +60,9 @@ local function get_cmd(opts, filter)
|
||||||
args[#args + 1] = "-L"
|
args[#args + 1] = "-L"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- extra args
|
||||||
|
vim.list_extend(args, opts.args or {})
|
||||||
|
|
||||||
-- file glob
|
-- file glob
|
||||||
---@type string?
|
---@type string?
|
||||||
local pattern, pargs = Snacks.picker.util.parse(filter.search)
|
local pattern, pargs = Snacks.picker.util.parse(filter.search)
|
||||||
|
|
|
@ -66,6 +66,9 @@ local function get_cmd(opts, filter)
|
||||||
args[#args + 1] = g
|
args[#args + 1] = g
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- extra args
|
||||||
|
vim.list_extend(args, opts.args or {})
|
||||||
|
|
||||||
args[#args + 1] = "--"
|
args[#args + 1] = "--"
|
||||||
|
|
||||||
-- search pattern
|
-- search pattern
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue