Closed Anthony-Fiddes closed 10 months ago
Thanks for the issue!
I can reproduce, but closing single window is not a proper way of closing explorer in 'mini.files'. That would be with a config.mappings.close
keys which is q
by default.
Since 274c6ed4892802750284c92c7cc2c0b943343d85, closing single window will eventually result into closing whole explorer in the same way as any lost focus functionality. But again, this is not the supported way of closing explorer.
I'll look into it to at least not result into an error.
I see what you're saying. I guess I'll add a after/ftplugin/minifiles.lua
remap for ZZ to q. I just want minifiles to gracefully close with both the intended keymap and the one I'm used to using.
Perhaps there could be an official recommendation for how to add multiple mappings for one minifiles concept (e.g., maybe we could assign a table for each mapping, or maybe ftplugin would be the recommended way to add extra maps).
Edit: Just realized that that will remap ZZ to q for other windows as soon as I open a minifiles window. I'm sure I can fix it up though.
Oh I see that you actually had an example in your docs of how to do this. Thanks for creating a lovely plugin and docs.
Here's the snippet that I ended up using, very similar to what was in the docs:
vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesBufferCreate",
callback = function(args)
vim.keymap.set("n", "ZZ", "q", { buffer = args.data.buf_id, remap = true })
end,
})
Here's the snippet that I ended up using, very similar to what was in the docs:
I'd recommend mapping explicitly to MiniFiles.close()
with something like vim.keymap.set("n", "ZZ", function() MiniFiles.close() end, { buffer = args.data.buf_id })
.
Thanks again for the issue!
It was not really about ZZ
per se, but that the single not first window was closed not properly. This should now be solved on latest main
branch.
Contributing guidelines
Module(s)
mini.files
Description
Closing the mini.files buffer with the ZZ command causes weird errors to occur.
Neovim version
0.9.1
Steps to reproduce
nvim -nu minimal.lua .
minimal.lua:
Expected behavior
mini.files closes normally as if the user had pressed
q
.Actual behavior