From 26ad9cef1c66c0203937cb76b92599a2acdb6982 Mon Sep 17 00:00:00 2001 From: Chaz Leong <13462818+cleong14@users.noreply.github.com> Date: Mon, 18 Dec 2023 20:22:25 -1000 Subject: [PATCH] feat: add yazi file manager support Signed-off-by: Chaz Leong <13462818+cleong14@users.noreply.github.com> --- README.md | 1 + lua/fm-nvim.lua | 11 ++++++++++- plugin/fm-nvim.lua | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dd47b12..f1a25b7 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ - [Twf](https://github.com/wvanlint/twf) - [Lf](https://github.com/gokcehan/lf) - [Fm](https://github.com/knipferrc/fm) +- [Yazi](https://github.com/sxyazi/yazi) diff --git a/lua/fm-nvim.lua b/lua/fm-nvim.lua index 4b5a183..9ec6e00 100644 --- a/lua/fm-nvim.lua +++ b/lua/fm-nvim.lua @@ -39,7 +39,8 @@ local config = { joshuto_cmd = "joshuto", lazygit_cmd = "lazygit", neomutt_cmd = "neomutt", - taskwarrior_cmd = "taskwarrior-tui" + taskwarrior_cmd = "taskwarrior-tui", + yazi_cmd = "yazi" }, mappings = { vert_split = "", @@ -289,5 +290,13 @@ function M.TaskWarriorTUI() createSplit(config.cmds.taskwarrior_cmd, "") end end +function M.Yazi(dir) + dir = dir or "." + if config.ui.default == "float" then + createWin(config.cmds.yazi_cmd .. " --chooser-file /tmp/fm-nvim " .. dir, "") + elseif config.ui.default == "split" then + createSplit(config.cmds.yazi_cmd .. " --chooser-file /tmp/fm-nvim " .. dir, "") + end +end return M diff --git a/plugin/fm-nvim.lua b/plugin/fm-nvim.lua index f278813..f523a6a 100644 --- a/plugin/fm-nvim.lua +++ b/plugin/fm-nvim.lua @@ -1,4 +1,4 @@ -local fileManagers = {"Lf", "Fm", "Nnn", "Fff", "Twf", "Xplr", "Vifm", "Broot", "Gitui", "Ranger", "Joshuto", "Lazygit"} +local fileManagers = {"Lf", "Fm", "Nnn", "Fff", "Twf", "Xplr", "Vifm", "Broot", "Gitui", "Ranger", "Joshuto", "Lazygit", "Yazi"} local executable = vim.fn.executable for _, fm in ipairs(fileManagers) do