diff options
| author | kylo252 <59826753+kylo252@users.noreply.github.com> | 2022-05-04 21:57:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-04 21:57:29 +0200 |
| commit | 3f3cba430e93f54289c296860b05cba141d32acc (patch) | |
| tree | 826073566697670556a64a314b73ec389a4a6c87 /lua | |
| parent | 8d1841bff5c70d05f458ded09e465ae4ac21ecce (diff) | |
feat(live_grep): add glob and type filter shorthand opts (#1695)
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/builtin/files.lua | 8 | ||||
| -rw-r--r-- | lua/telescope/builtin/init.lua | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua index 6a1d2a5..2dd11c7 100644 --- a/lua/telescope/builtin/files.lua +++ b/lua/telescope/builtin/files.lua @@ -72,6 +72,14 @@ files.live_grep = function(opts) additional_args = opts.additional_args(opts) end + if opts.type_filter then + additional_args[#additional_args + 1] = "--type=" .. opts.type_filter + end + + if opts.glob_pattern then + additional_args[#additional_args + 1] = "--glob=" .. opts.glob_pattern + end + local live_grepper = finders.new_job(function(prompt) -- TODO: Probably could add some options for smart case and whatever else rg offers. diff --git a/lua/telescope/builtin/init.lua b/lua/telescope/builtin/init.lua index e8e88e8..e6ed448 100644 --- a/lua/telescope/builtin/init.lua +++ b/lua/telescope/builtin/init.lua @@ -55,6 +55,8 @@ end ---@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 search_dirs table: directory/directories to search in, 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 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 max_results number: define a upper result value ---@field disable_coordinates boolean: don't show the line & row numbers (default: false) |
