feat(rg): pass multiple globs to rg by default (#2003)
This commit is contained in:
@@ -821,26 +821,28 @@ builtin.live_grep({opts}) *telescope.builtin.live_grep()*
|
|||||||
{opts} (table) options to pass to the picker
|
{opts} (table) options to pass to the picker
|
||||||
|
|
||||||
Options: ~
|
Options: ~
|
||||||
{cwd} (string) root dir to search from (default:
|
{cwd} (string) root dir to search from
|
||||||
cwd, use utils.buffer_dir() to
|
(default: cwd, use
|
||||||
search relative to open buffer)
|
utils.buffer_dir() to search
|
||||||
{grep_open_files} (boolean) if true, restrict search to open
|
relative to open buffer)
|
||||||
files only, mutually exclusive with
|
{grep_open_files} (boolean) if true, restrict search to open
|
||||||
`search_dirs`
|
files only, mutually exclusive
|
||||||
{search_dirs} (table) directory/directories/files to
|
with `search_dirs`
|
||||||
search, mutually exclusive with
|
{search_dirs} (table) directory/directories/files to
|
||||||
`grep_open_files`
|
search, mutually exclusive with
|
||||||
{glob_pattern} (string) argument to be used with `--glob`,
|
`grep_open_files`
|
||||||
e.g. "*.toml", can use the opposite
|
{glob_pattern} (string|table) argument to be used with
|
||||||
"!*.toml"
|
`--glob`, e.g. "*.toml", can use
|
||||||
{type_filter} (string) argument to be used with `--type`,
|
the opposite "!*.toml"
|
||||||
e.g. "rust", see `rg --type-list`
|
{type_filter} (string) argument to be used with
|
||||||
{additional_args} (function) function(opts) which returns a table
|
`--type`, e.g. "rust", see `rg
|
||||||
of additional arguments to be passed
|
--type-list`
|
||||||
on
|
{additional_args} (function) function(opts) which returns a
|
||||||
{max_results} (number) define a upper result value
|
table of additional arguments to
|
||||||
{disable_coordinates} (boolean) don't show the line & row numbers
|
be passed on
|
||||||
(default: false)
|
{max_results} (number) define a upper result value
|
||||||
|
{disable_coordinates} (boolean) don't show the line & row
|
||||||
|
numbers (default: false)
|
||||||
|
|
||||||
|
|
||||||
builtin.grep_string({opts}) *telescope.builtin.grep_string()*
|
builtin.grep_string({opts}) *telescope.builtin.grep_string()*
|
||||||
|
|||||||
@@ -76,8 +76,12 @@ files.live_grep = function(opts)
|
|||||||
additional_args[#additional_args + 1] = "--type=" .. opts.type_filter
|
additional_args[#additional_args + 1] = "--type=" .. opts.type_filter
|
||||||
end
|
end
|
||||||
|
|
||||||
if opts.glob_pattern then
|
if type(opts.glob_pattern) == "string" then
|
||||||
additional_args[#additional_args + 1] = "--glob=" .. opts.glob_pattern
|
additional_args[#additional_args + 1] = "--glob=" .. opts.glob_pattern
|
||||||
|
elseif type(opts.glob_pattern) == "table" then
|
||||||
|
for i = 1, #opts.glob_pattern do
|
||||||
|
additional_args[#additional_args + 1] = "--glob=" .. opts.glob_pattern[i]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local live_grepper = finders.new_job(function(prompt)
|
local live_grepper = finders.new_job(function(prompt)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ end
|
|||||||
---@field cwd string: root dir to search from (default: cwd, use utils.buffer_dir() to search relative to open buffer)
|
---@field cwd string: root dir to search from (default: cwd, use utils.buffer_dir() to search relative to open buffer)
|
||||||
---@field grep_open_files boolean: if true, restrict search to open files only, mutually exclusive with `search_dirs`
|
---@field grep_open_files boolean: if true, restrict search to open files only, mutually exclusive with `search_dirs`
|
||||||
---@field search_dirs table: directory/directories/files to search, mutually exclusive with `grep_open_files`
|
---@field search_dirs table: directory/directories/files to search, mutually exclusive with `grep_open_files`
|
||||||
---@field glob_pattern string: argument to be used with `--glob`, e.g. "*.toml", can use the opposite "!*.toml"
|
---@field glob_pattern string|table: argument to be used with `--glob`, e.g. "*.toml", can use the opposite "!*.toml"
|
||||||
---@field type_filter string: argument to be used with `--type`, e.g. "rust", see `rg --type-list`
|
---@field type_filter string: argument to be used with `--type`, e.g. "rust", see `rg --type-list`
|
||||||
---@field additional_args function: function(opts) which returns a table of additional arguments to be passed on
|
---@field additional_args function: function(opts) which returns a table of additional arguments to be passed on
|
||||||
---@field max_results number: define a upper result value
|
---@field max_results number: define a upper result value
|
||||||
|
|||||||
Reference in New Issue
Block a user