Skip to content

Commit

Permalink
fix: race condition when entering oil buffer (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Apr 19, 2024
1 parent f41d7e7 commit c86e484
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lua/oil/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -787,13 +787,12 @@ M.run_after_load = function(bufnr, callback)
if vim.b[bufnr].oil_ready then
callback()
else
local autocmd_id
autocmd_id = vim.api.nvim_create_autocmd("User", {
vim.api.nvim_create_autocmd("User", {
pattern = "OilEnter",
callback = function(args)
if args.data.buf == bufnr then
callback()
vim.api.nvim_del_autocmd(autocmd_id)
vim.api.nvim_buf_call(bufnr, callback)
return true
end
end,
})
Expand Down

0 comments on commit c86e484

Please sign in to comment.