Add telescopes provider (#168)

Amendment: replace the old `builtin`
This commit is contained in:
Simon Zeng
2020-10-24 23:00:22 -04:00
committed by GitHub
parent 5aa20f1f54
commit 59ef37ded4
2 changed files with 13 additions and 0 deletions

View File

@@ -165,6 +165,15 @@ actions.set_command_line = function(prompt_bufnr)
vim.cmd(entry.value)
end
actions.run_builtin = function(prompt_bufnr)
local entry = actions.get_selected_entry(prompt_bufnr)
actions.close(prompt_bufnr)
vim.cmd [[startinsert]]
require('telescope.builtin')[entry.text]()
end
-- TODO: Think about how to do this.
actions.insert_value = function(prompt_bufnr)
local entry = actions.get_selected_entry(prompt_bufnr)

View File

@@ -523,6 +523,10 @@ builtin.builtin = function(opts)
},
previewer = previewers.qflist.new(opts),
sorter = conf.generic_sorter(opts),
attach_mappings = function(_, map)
map('i', '<CR>', actions.run_builtin)
return true
end
}):find()
end