diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-23 12:12:31 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-23 12:12:37 -0400 |
| commit | 7871d392ad9ad709d5f518e26bc7178e86180b6c (patch) | |
| tree | cf433e0804a0e59b6c5b7d1ff4c11f2dd3e9280c /lua | |
| parent | 203c696230cb00ffa0225c0bbc7ac96ec95273bb (diff) | |
wip: Add some WIP ideas for reloader
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/WIP.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lua/telescope/WIP.lua b/lua/telescope/WIP.lua index 1ababec..f6dac64 100644 --- a/lua/telescope/WIP.lua +++ b/lua/telescope/WIP.lua @@ -1,4 +1,6 @@ +local make_entry = require('telescope.make_entry') +local actions = require('telescope.actions') local finders = require('telescope.finders') local previewers = require('telescope.previewers') local pickers = require('telescope.pickers') @@ -54,6 +56,35 @@ WIP.completion = function(opts) reference_picker:find {} end + +WIP.reloader = function(opts) + opts = opts or {} + + pickers.new(opts, { + prompt = 'Packages', + finder = finders.new_table { + results = vim.tbl_keys(package.loaded), + entry_maker = make_entry.gen_from_string(opts), + }, + sorter = sorters.get_generic_fuzzy_sorter(), + + attach_mappings = function(prompt_bufnr, map) + local reload_package = function() + local selection = actions.get_selected_entry(prompt_bufnr) + + actions.close(prompt_bufnr) + + print(vim.inspect(selection)) + end + + map('i', '<CR>', reload_package) + map('n', '<CR>', reload_package) + + return true + end + }):find() +end + -- TODO: Use tree sitter to get "everything" in your current scope / file / etc. -- Fuzzy find ofver it, go to its definition. |
