summaryrefslogtreecommitdiff
path: root/lua/telescope/builtin/internal.lua
diff options
context:
space:
mode:
authorkylo252 <59826753+kylo252@users.noreply.github.com>2021-12-27 09:48:34 +0100
committerGitHub <noreply@github.com>2021-12-27 09:48:34 +0100
commita1f838d436fefa092159b6b2b96802d222c6145e (patch)
tree4d0e991504925ddcd6c6f551c7f4ed7f1f08ef3c /lua/telescope/builtin/internal.lua
parent627d89c959292628827239d421357a653144e44f (diff)
chore: remove redundant run_builtin action (#1589)
Diffstat (limited to 'lua/telescope/builtin/internal.lua')
-rw-r--r--lua/telescope/builtin/internal.lua27
1 files changed, 21 insertions, 6 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua
index 7892ba4..316d76a 100644
--- a/lua/telescope/builtin/internal.lua
+++ b/lua/telescope/builtin/internal.lua
@@ -31,12 +31,7 @@ end
local internal = {}
--- TODO: What the heck should we do for accepting this.
--- vim.fn.setreg("+", "nnoremap $TODO :lua require('telescope.builtin').<whatever>()<CR>")
--- TODO: Can we just do the names instead?
internal.builtin = function(opts)
- opts.path_display = utils.get_default(opts.path_display, "hidden")
- opts.ignore_filename = utils.get_default(opts.ignore_filename, true)
opts.include_extensions = utils.get_default(opts.include_extensions, false)
local objs = {}
@@ -84,7 +79,27 @@ internal.builtin = function(opts)
previewer = previewers.builtin.new(opts),
sorter = conf.generic_sorter(opts),
attach_mappings = function(_)
- actions.select_default:replace(actions.run_builtin)
+ actions.select_default:replace(function(_)
+ local selection = action_state.get_selected_entry()
+ if not selection then
+ print "[telescope] Nothing currently selected"
+ return
+ end
+
+ -- we do this to avoid any surprises
+ opts.include_extensions = nil
+
+ 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)
+ else
+ -- Call appropriate telescope builtin
+ require("telescope.builtin")[selection.text](opts)
+ end
+ end)
return true
end,
}):find()