feat: add handling for file_browser commands across multiple providers

This commit is contained in:
2024-11-05 05:56:11 -05:00
parent 0f95168172
commit bcccd5be1c
+18 -5
View File
@@ -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",