1
0

Add telescope binding to swap file finder and bufs

This commit is contained in:
Patrick Auernig 2024-01-30 19:39:03 +01:00
parent 2988dc3cb5
commit eabe6335b3

View File

@ -18,8 +18,22 @@ spec.keys = {
spec.config = function() spec.config = function()
local telescope = require("telescope") local telescope = require("telescope")
local builtin = require("telescope.builtin")
local actions = require("telescope.actions") 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.load_extension("harpoon")
telescope.setup { telescope.setup {
@ -31,12 +45,20 @@ spec.config = function()
mappings = { mappings = {
i = { i = {
["<C-d>"] = actions.delete_buffer + actions.move_to_top, ["<C-d>"] = actions.delete_buffer + actions.move_to_top,
["<C-f>"] = cycle_picker,
}, },
n = { n = {
["dd"] = actions.delete_buffer, ["dd"] = actions.delete_buffer,
} }
} }
}, },
find_files = {
mappings = {
i = {
["<C-f>"] = cycle_picker,
}
}
}
} }
} }