diff --git a/lua/valeth/plugins/telescope.lua b/lua/valeth/plugins/telescope.lua index 6d23de1..a39d45c 100644 --- a/lua/valeth/plugins/telescope.lua +++ b/lua/valeth/plugins/telescope.lua @@ -18,8 +18,22 @@ spec.keys = { spec.config = function() local telescope = require("telescope") + local builtin = require("telescope.builtin") local actions = require("telescope.actions") + local cycle_picker = function(bufnr) + local state = require("telescope.actions.state") + local current_picker = state.get_current_picker(bufnr) + + local title = current_picker.prompt_title + + if title == "Buffers" then + builtin.find_files() + elseif title == "Find Files" then + builtin.buffers() + end + end + telescope.load_extension("harpoon") telescope.setup { @@ -31,12 +45,20 @@ spec.config = function() mappings = { i = { [""] = actions.delete_buffer + actions.move_to_top, + [""] = cycle_picker, }, n = { ["dd"] = actions.delete_buffer, } } }, + find_files = { + mappings = { + i = { + [""] = cycle_picker, + } + } + } } }