diff --git a/config/nvim-work/lua/plugins/lazy/mini-files.lua b/config/nvim-work/lua/plugins/lazy/mini-files.lua index 391d917..ca669fe 100644 --- a/config/nvim-work/lua/plugins/lazy/mini-files.lua +++ b/config/nvim-work/lua/plugins/lazy/mini-files.lua @@ -3,33 +3,37 @@ return { "echasnovski/mini.files", version = "*", -- Use the latest stable version + keys = { + { + "e", + function() + -- Check if a mini.files window is already open + local mini_files_open = false + for _, win in ipairs(vim.api.nvim_list_wins()) do + if vim.bo[vim.api.nvim_win_get_buf(win)].filetype == "minifiles" then + mini_files_open = true + break + end + end + + if mini_files_open then + -- If it's open, close it + require("mini.files").close() + else + -- If it's not open, open it + require("mini.files").open() + end + end, + desc = "Toggle file explorer (mini.files)" + }, + }, config = function() - -- Setup mini.files with custom mappings + -- Setup mini.files with default mappings require("mini.files").setup({ - mappings = { - -- Go to parent directory with 'L' - go_in_plus = "L", - }, + -- Using default mappings: + -- 'l' or '' to enter directory/open file + -- 'h' or '' to go to parent directory + -- 'j'/'k' or ''/'' to navigate }) - - -- Custom keymap to toggle the file explorer - vim.keymap.set("n", "e", function() - -- Check if a mini.files window is already open - local mini_files_open = false - for _, win in ipairs(vim.api.nvim_list_wins()) do - if vim.bo[vim.api.nvim_win_get_buf(win)].filetype == "minifiles" then - mini_files_open = true - break - end - end - - if mini_files_open then - -- If it's open, close it - require("mini.files").close() - else - -- If it's not open, open it - require("mini.files").open() - end - end, { desc = "Toggle file explorer (mini.files)" }) end, }