Skip to content

Commit

Permalink
feat(oil-nvim): close buffers when deleting in Oil
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Mar 19, 2024
1 parent 3203899 commit c2218d5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lua/astrocommunity/file-explorer/oil-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ return {
pattern = "oil",
callback = function(args) vim.b[args.buf].view_activated = false end,
},
{
event = "User",
pattern = "OilActionsPost",
desc = "Close buffers when files are deleted in Oil",
callback = function(args)
if args.data.err then return end
for _, action in ipairs(args.data.actions) do
if action.type == "delete" then
local _, path = require("oil.util").parse_url(action.url)
local bufnr = vim.fn.bufnr(path)
if bufnr ~= -1 then require("astrocore.buffer").wipe(bufnr, true) end
end
end
end,
},
},
},
},
Expand Down

0 comments on commit c2218d5

Please sign in to comment.