From bcccd5be1c636cb9d71058f0c173cc5615ab42ad Mon Sep 17 00:00:00 2001 From: rootiest Date: Tue, 5 Nov 2024 05:56:11 -0500 Subject: [PATCH] feat: add handling for file_browser commands across multiple providers --- lua/data/func.lua | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lua/data/func.lua b/lua/data/func.lua index 5206a6a..05762d0 100644 --- a/lua/data/func.lua +++ b/lua/data/func.lua @@ -1698,11 +1698,7 @@ function M.pick(cmd, provider, options) end -- Handle special commands - if cmd == "files" and M.is_git_repo() then - cmd = "git_files" - elseif cmd == "FILES" then - cmd = "files" - elseif cmd == "config_files" then + if cmd == "config_files" then cmd = "files" options = { cwd = vim.fn.stdpath("config") } end @@ -1738,6 +1734,23 @@ function M.pick(cmd, provider, options) end end + -- Handle special cases + if cmd == "file_browser" then + if provider == "mini" then + require("mini.files").open() + return true + elseif provider == "neotree" then + vim.cmd("Neotree reveal") + return true + elseif provider == "oil" then + require("oil").open() + return true + else + require("telescope").extensions.file_browser.file_browser() + return true + end + end + -- If no provider supports the cmd, throw an error vim.notify( "Unknown command: " .. cmd .. " for providers: fzf-lua, telescope",