mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-28 03:30:12 +02:00
feat(mini.files): "g." to toggle hidden files (#964)
This commit is contained in:
parent
eb7b4fc369
commit
a080bc7667
1 changed files with 22 additions and 0 deletions
|
@ -26,4 +26,26 @@ return {
|
||||||
desc = "Open mini.files (cwd)",
|
desc = "Open mini.files (cwd)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("mini.files").setup(opts)
|
||||||
|
|
||||||
|
local show_dotfiles = true
|
||||||
|
local filter_show = function(fs_entry) return true end
|
||||||
|
local filter_hide = function(fs_entry) return not vim.startswith(fs_entry.name, ".") end
|
||||||
|
|
||||||
|
local toggle_dotfiles = function()
|
||||||
|
show_dotfiles = not show_dotfiles
|
||||||
|
local new_filter = show_dotfiles and filter_show or filter_hide
|
||||||
|
require("mini.files").refresh({ content = { filter = new_filter } })
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "MiniFilesBufferCreate",
|
||||||
|
callback = function(args)
|
||||||
|
local buf_id = args.data.buf_id
|
||||||
|
-- Tweak left-hand side of mapping to your liking
|
||||||
|
vim.keymap.set("n", "g.", toggle_dotfiles, { buffer = buf_id })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue