I would like to propose adding an integration recipe for mini.files to the grug-far.nvim README. This integration allows users to easily search within the current working directory using grug-far when navigating files with mini.files.
local files_grug_far_cwd = function(path)
-- Works only if cursor is on the valid file system entry
local cur_entry_path = MiniFiles.get_fs_entry().path
local prefills = { paths = vim.fs.dirname(cur_entry_path) }
local grug_far = require "grug-far"
if not grug_far.has_instance "explorer" then
grug_far.open {
name = "explorer",
prefills = prefills,
staticTitle = "Find and Replace from Explorer",
}
else
grug_far.open_instance "explorer"
-- updating the prefills without crealing the search and other fields
grug_far.update_instance_prefills("explorer", prefills, false)
end
end
autocmd("User", {
pattern = "MiniFilesBufferCreate",
callback = function(args)
map("n", "gs", files_grug_far_cwd, { buffer = args.data.buf_id, desc = "Search cwd" })
end,
})
I would like to propose adding an integration recipe for
mini.files
to thegrug-far.nvim
README. This integration allows users to easily search within the current working directory using grug-far when navigating files with mini.files.