Open fnune opened 23 hours ago
Yeah, I had a similar thought the other day. Is this something you want to take a crack at?
I can do it, but WDYT about the design alternatives?
I can make my own assumptions/decisions, but happy to hear what you think :)
You could probably get away with using a floating window that has the same background color as the buffer, that doesn't get focused on creation. Maybe even just vim.notify()
with some extra arguments?
Or, echo/redraw so it appears in the cmd line. The Refs buffer does that when loading cherries for a ref.
Statusbar could be fine, but I havent messed with that before.
I wouldn't put it as -part- of the status buffer though. That would get expensive to rerender just for a spinner
You could probably get away with using a floating window that has the same background color as the buffer
What do you mean by this? A sort of overlay on top of the Neogit status window?
Or something small on the side like a Noice notification? (but not using Noice, heh)
Statusbar could be fine, but I havent messed with that before.
Maybe this is an easy approach and a good start:
Example:
-- Neogit config
auto_show_console_error_only = true
-- Lualine example with lazy.nvim
return {
"nvim-lualine/lualine.nvim",
config = function()
local lualine = require("lualine")
lualine.setup({
sections = {
lualine_a = { "mode", require("neogit.process").status },
},
})
end,
}
Then it's mostly done.
You could probably get away with using a floating window that has the same background color as the buffer
What do you mean by this? A sort of overlay on top of the Neogit status window?
Yeah, like that. Noice (and fidget, nvim-notify, cmp, ...) just place a floating window. Without a border it would blend in very smoothly.
I think showing on error-only would make sense. Since I added some logic to check for git hooks a few days ago, the "timer" idea doesn't really make sense to me. Like, I suppose if something is taking a long time you might want to see why, but besides a hook I'm not sure what would take a long time.
Would the status line get repainted frequently enough to make a spinner meaningful? IIRC it's a poll model, not a push model, so if it stopped polling for updates you might get stale state shown. But maybe I'm wrong 🤷🏼 Regardless, I'm not against it.
Here's a little POC for a spinner in the message window, if you like:
api.nvim_create_user_command("SpinnerPOC", function(args)
local pattern = {
"-",
"\\",
"|",
"/"
}
local function setInterval(interval, callback)
local timer = vim.uv.new_timer()
timer:start(interval, interval, function()
callback()
end)
return timer
end
local function clearInterval(timer)
timer:stop()
timer:close()
end
local count = 0
local timer = setInterval(50, vim.schedule_wrap(function()
count = count + 1
vim.cmd(string.format("redraw | echomsg '%s Running Process'", pattern[(count % #pattern) + 1]))
end))
vim.defer_fn(
function()
clearInterval(timer)
vim.cmd("redraw | echomsg ''")
end,
3000
)
end, {
desc = "spin POC",
})
I set my
console_timeout
to250
because many of the commands I run end up showing the console, so I'd rather see it quickly.However, most of the time I can just dismiss it. It will also close automatically. So that means it's not really of any use to me other than for the fact that it lets me know that something's happening and Neogit isn't frozen.
That's why I think this should be Neogit's behavior: