diff options
| author | Bjarki Baldursson Harksen <62466569+mrbjarksen@users.noreply.github.com> | 2022-06-12 11:08:30 +0000 |
|---|---|---|
| committer | Simon Hauser <simon.hauser@helsinki-systems.de> | 2022-06-30 14:01:50 +0200 |
| commit | 6703c957e7d9a5dc5f91ceb59326ab7e05274642 (patch) | |
| tree | 95ed4500e032597cbd3d484a503fc28e32fa78da /lua/telescope/builtin/internal.lua | |
| parent | 15f6a0bb08f934bc999c8b5e54fb574f5889558f (diff) | |
feat: add option `use_default_opts` to `builtin.builtin` (#1996)
Diffstat (limited to 'lua/telescope/builtin/internal.lua')
| -rw-r--r-- | lua/telescope/builtin/internal.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua index 8a41500..e4a5704 100644 --- a/lua/telescope/builtin/internal.lua +++ b/lua/telescope/builtin/internal.lua @@ -33,6 +33,7 @@ local internal = {} internal.builtin = function(opts) opts.include_extensions = vim.F.if_nil(opts.include_extensions, false) + opts.use_default_opts = vim.F.if_nil(opts.use_default_opts, false) local objs = {} @@ -91,15 +92,20 @@ internal.builtin = function(opts) -- we do this to avoid any surprises opts.include_extensions = nil + local picker_opts + if not opts.use_default_opts then + picker_opts = opts + end + if string.match(selection.text, " : ") then -- Call appropriate function from extensions local split_string = vim.split(selection.text, " : ") local ext = split_string[1] local func = split_string[2] - require("telescope").extensions[ext][func](opts) + require("telescope").extensions[ext][func](picker_opts) else -- Call appropriate telescope builtin - require("telescope.builtin")[selection.text](opts) + require("telescope.builtin")[selection.text](picker_opts) end end) return true |
