Closed charlesbido closed 2 weeks ago
Hi! Glad you like 'mini.files'!
The MiniFiles.open()
function takes arguments which can be used in different ways.
For described case it seems that using MiniFiles.open(vim.api.nvim_buf_get_name(0))
(which opens directory of current file in a last used state with focus on that file) instead of plain MiniFiles.open()
.
@echasnovski oh perfect! I should've checked the docs instead of just the README.md
I'll take a look and create bindings for this - also, thanks for the super fast response that was nearly instantaneous 🏎️ 🔥 wow
You might want to check to make sure buftype ~= "nofile"
so you don't get an error if you use your mapping while in a buffer that doesn't have a real file associated with it. For example, if I use my mapping while on MiniStarter screen, the buftype is "nofile", but the buffer name looks like a path that is not a real file, so I'd get an error if I didn't add this check:
M.minifiles_open_buffer_path = function()
local path = vim.bo.buftype ~= "nofile" and vim.api.nvim_buf_get_name(0) or nil
MiniFiles.open(path)
end
@pkazmier This works well for my setup! Thanks for the recipe 😄
Contributing guidelines
Module(s)
mini.files
Description
Hey y'all 👋 first of all thank you to everyone who developed this module, it's by far my favorite file navigator in neovim ❤️
I'm running into the following issue (forgive the Gherkin, but its effective for describing the issue):
I want to be in the directory where the file in the second pane is located so that
I'm actually unsure if this is simply a bug, or would be considered a feature request (please let me know), but I think this behavior is typical in other file navigators such as Lf / Ranger / NERDTree and would address a lot of common use-cases.
Again many thanks!
Neovim version
NVIM v0.10.0
Steps to reproduce
Expected behavior
When invoking Mini.files while on a pane (pane 1), it shows the file (file 1) at its location. Then when switching to another pane (pane 2) and invoking Mini.files, then it shows the file (file 2) at its location.
Actual behavior
It opens the last location navigated in mini.files