neogit
neogit copied to clipboard
Automatically refresh upon `BufEnter`?
Wouldn't it make sense to add BufEnter to this autocmd? I'm finding myself having to manually refresh all the time. Since it's async I don't think this would freeze the UI at all. Maybe an option could be added?
EDIT: I misunderstood the point of this autocommand in particular. Please ignore.
https://github.com/NeogitOrg/neogit/blob/757c74cf4d5765d39370ebb48cbcf1ea44c2f84d/lua/neogit/autocmds.lua#L22-L38
I'm going to add this to my config, even though it fires unnecessarily on initial NeogitStatus opening.
local neogit = require('neogit')
local a = require("plenary.async")
local status_buffer = require("neogit.buffers.status")
local group = require("neogit").autocmd_group
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = "NeogitStatus",
callback = a.void(function(o)
status_buffer.instance():dispatch_refresh(nil, o.event)
end),
group = group,
})
Simpler version:
local neogit = require('neogit')
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = "NeogitStatus",
callback = function()
neogit.dispatch_refresh()
end,
group = neogit.autocmd_group,
})
I agree with @stelcodes, I would also add FocusGained