local mapSilent = require("my.keymaps").mapSilent local M = {} local bindings = { builtin = { -- Open files with control + P find_files = "", -- Search through files with control + F live_grep = "", -- See diagnostics with space + d lsp_document_diagnostics = "d", lsp_workspace_diagnostics = "wd", lsp_code_actions = "ca", -- Open a list with all the pickers builtin = "t", -- List function, var names etc treesitter = "s", -- Git stuff git_commits = "gj", git_branches = "gk" }, ["extensions.file_browser.file_browser"] = "p" } local function setupKeybinds(obj, path) if path == nil then path = "" end for name, keybinds in pairs(obj) do if (type(keybinds) == "table") then -- This means we found a table of keybinds, so we go deeper setupKeybinds(keybinds, path .. "." .. name) else -- Maps the keybind to the action mapSilent('n', keybinds, "lua require('telescope" .. path .. "')." .. name .. "()") end end end function M.setup() setupKeybinds(bindings) local settings = { defaults = {mappings = {i = {[""] = "which_key"}}}, extensions = { file_browser = { mappings = { -- Comment so this does not get collapsed } } } } require("telescope").setup(settings) require("telescope").load_extension "file_browser" end return M