Public Access
refreshing the shortcuts
This commit is contained in:
@@ -48,7 +48,7 @@ Git shortcuts:
|
||||
- `[h`, `]h`, `[H`, `]H` jump to hunks
|
||||
- `<leader>th` — toggle the expanded hunk view
|
||||
|
||||
Refresh shortcuts (oil and buffers):
|
||||
Refresh shortcuts (mini.files and buffers):
|
||||
|
||||
- `gR` refresh the current buffer
|
||||
- `<F5>` refresh the current buffer
|
||||
|
||||
@@ -337,9 +337,43 @@ local function refresh()
|
||||
end)
|
||||
end
|
||||
|
||||
local function refresh_filetree()
|
||||
M.invalidate()
|
||||
if _G.MiniFiles == nil or MiniFiles.get_explorer_state() == nil then
|
||||
return
|
||||
end
|
||||
|
||||
vim.schedule(function()
|
||||
if MiniFiles.get_explorer_state() ~= nil then
|
||||
MiniFiles.refresh({
|
||||
content = {
|
||||
filter = M.filter,
|
||||
highlight = M.highlight,
|
||||
},
|
||||
})
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
local group = vim.api.nvim_create_augroup("romanzy_mini_files_git", { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
group = group,
|
||||
pattern = "MiniFilesBufferCreate",
|
||||
callback = function(args)
|
||||
if args.data == nil then
|
||||
return
|
||||
end
|
||||
|
||||
for _, lhs in ipairs({ "gR", "<F5>" }) do
|
||||
vim.keymap.set("n", lhs, refresh_filetree, {
|
||||
buffer = args.data.buf_id,
|
||||
desc = "refresh mini.files filetree",
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost", "FocusGained", "TermClose" }, {
|
||||
group = group,
|
||||
callback = refresh,
|
||||
|
||||
Reference in New Issue
Block a user