Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 29 additions & 25 deletions config/nvim-work/lua/plugins/lazy/mini-files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,37 @@
return {
"echasnovski/mini.files",
version = "*", -- Use the latest stable version
keys = {
{
"<space>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 '<Right>' to enter directory/open file
-- 'h' or '<Left>' to go to parent directory
-- 'j'/'k' or '<Down>'/'<Up>' to navigate
})

-- Custom keymap to toggle the file explorer
vim.keymap.set("n", "<space>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,
}