From 7e8af881a3c784e5aaf2ab11cdc2e96198c79ad8 Mon Sep 17 00:00:00 2001 From: aleidk Date: Thu, 15 Feb 2024 22:54:40 -0300 Subject: [PATCH] Change nvim file explorer plugin for yazi integration --- config/nvim/lazy-lock.json | 2 +- .../nvim/lua/aleidk/plugins/file-browser.lua | 2 +- .../nvim/lua/aleidk/plugins/file-explorer.lua | 66 +++++++++++++++++++ 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 config/nvim/lua/aleidk/plugins/file-explorer.lua diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index a62442c..2fb0756 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -40,7 +40,6 @@ "nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" }, "nvim-lint": { "branch": "master", "commit": "962a76877a4479a535b935bd7ef35ad41ba308b2" }, "nvim-lspconfig": { "branch": "master", "commit": "6c797ff9324094e333e2ace9526ca4a62ad9d1ca" }, - "nvim-tree.lua": { "branch": "master", "commit": "78a9ca5ed6557f29cd0ce203df44213e54bfabb9" }, "nvim-treesitter": { "branch": "master", "commit": "107e61afb7129d637ea6c3c68b97a22194b0bf16" }, "nvim-treesitter-context": { "branch": "master", "commit": "8aa32aa6b84dda357849dbc0f775e69f2e04c041" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "eb208bfdfcf76efea0424747e23e44641e13aaa6" }, @@ -54,6 +53,7 @@ "telescope-file-browser.nvim": { "branch": "master", "commit": "6e51d0cd6447cf2525412220ff0a2885eef9039c" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, + "tfm.nvim": { "branch": "main", "commit": "0fd23be8d4adebcc65a30b3870c2090b97dc1bc2" }, "todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" }, "treesj": { "branch": "main", "commit": "070e6761d0b11a55446d988a69908f7a0928dbab" }, "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, diff --git a/config/nvim/lua/aleidk/plugins/file-browser.lua b/config/nvim/lua/aleidk/plugins/file-browser.lua index 6c420d0..f90f761 100644 --- a/config/nvim/lua/aleidk/plugins/file-browser.lua +++ b/config/nvim/lua/aleidk/plugins/file-browser.lua @@ -1,7 +1,7 @@ return { { "nvim-tree/nvim-tree.lua", - -- enabled = false, + enabled = false, version = "*", dependencies = { "nvim-tree/nvim-web-devicons", diff --git a/config/nvim/lua/aleidk/plugins/file-explorer.lua b/config/nvim/lua/aleidk/plugins/file-explorer.lua new file mode 100644 index 0000000..2fe15eb --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/file-explorer.lua @@ -0,0 +1,66 @@ +return { + "rolv-apneseth/tfm.nvim", + lazy = false, + opts = { + -- TFM to use + -- Possible choices: "ranger" | "nnn" | "lf" | "vifm" | "yazi" (default) + file_manager = "yazi", + -- Replace netrw entirely + -- Default: false + replace_netrw = true, + -- Enable creation of commands + -- Default: false + -- Commands: + -- Tfm: selected file(s) will be opened in the current window + -- TfmSplit: selected file(s) will be opened in a horizontal split + -- TfmVsplit: selected file(s) will be opened in a vertical split + -- TfmTabedit: selected file(s) will be opened in a new tab page + enable_cmds = true, + -- Custom keybindings only applied within the TFM buffer + -- Default: {} + keybindings = { + [""] = "q", + }, + -- Customise UI. The below options are the default + ui = { + border = "rounded", + height = 1, + width = 1, + x = 0.5, + y = 0.5, + }, + }, + keys = { + { + "e", + function() + require("tfm").open() + end, + desc = "TFM", + }, + { + "mh", + function() + local tfm = require("tfm") + tfm.open(nil, tfm.OPEN_MODE.split) + end, + desc = "TFM - horizontal split", + }, + { + "mv", + function() + local tfm = require("tfm") + tfm.open(nil, tfm.OPEN_MODE.vsplit) + end, + desc = "TFM - vertical split", + }, + { + "mt", + function() + local tfm = require("tfm") + tfm.open(nil, tfm.OPEN_MODE.tabedit) + end, + desc = "TFM - new tab", + }, + }, +}