return { "mini.pick", lazy = true, cmd = "Pick", after = function() local win_config = function() local height = math.floor(0.618 * vim.o.lines) local width = math.floor(0.618 * vim.o.columns) return { anchor = 'NW', height = height, width = width, row = math.floor(0.5 * (vim.o.lines - height)), col = math.floor(0.5 * (vim.o.columns - width)), } end require("mini.pick").setup { window = { config = win_config, }, } vim.cmd.packadd("mini.extra") require("mini.extra").setup() vim.ui.select = MiniPick.ui_select -- Switch to a dir in the zoxide database MiniPick.registry.zoxide = function() local zoxide_output = vim.fn.system('zoxide query -l') local zoxide_dirs = vim.split(zoxide_output, '\n', { trimempty = true }) MiniPick.start({ source = { items = zoxide_dirs, name = "zoxide", choose = function(dir) vim.fn.chdir(dir) end } }) end -- Switch to a subdir of the current dir MiniPick.registry.cd = function(local_opts) local scope = local_opts.scope or 'current' local fd_output = vim.fn.system('fd -t d') local fd_dirs = vim.split(fd_output, '\n', { trimempty = true }) MiniPick.start({ source = { items = fd_dirs, name = (scope == 'tab') and "tcd" or "cd", choose = function (dir) if (scope == 'tab') then vim.cmd.tcd(dir) else vim.cmd.cd(dir) end end } }) end end }