NeogitOrg / neogit

An interactive and powerful Git interface for Neovim, inspired by Magit
MIT License
3.71k stars 221 forks source link

Autorefresh not working after writing a file? #1265

Closed petobens closed 3 months ago

petobens commented 3 months ago

Hi! AFAICT in nightly the filewatcher settings is always set to true. However, as it can be (almost) seen in the GIF, when I add a change to a file and write the file then the Status window doesn't autorefresh but rather I need to move to the Status window and press <C-r> for it to do so. Dunno if this a feature or bug:

Peek 2024-04-28 16-55

CKolkey commented 3 months ago

Right, the filewatcher only watches files inside ./.git/, so if you stage something from another place, or some internal rebase stuff, merge stuff, it'll do an update. Would be pretty cool to watch other open buffers, though. I'll see what it would take to track that stuff.

CKolkey commented 3 months ago

Ok! Turns out, there's already an autocmd that should have been doing this.. But, because I had opted-out of updating non-focused buffers because you can make folds in unfocused buffers, it wasn't working. So, I rewrote how we do folds slightly so it's always called in the right context: 1d021f2d08e5f2eaa5055ffcec9914df7e48a135

Should be good now! Thanks for the tip.

petobens commented 3 months ago

Hi @CKolkey. Thanks for the quick reply. Mmm I tried this (as in the GIF) and i) I still need to press <C-r> for the status buffer to refresh, ii) now the folds are highlighted in gray instead of white (I guess that should be easy to fix/override) and iii) I'm getting a strange error with the following traceback

E5108: Error executing lua: vim/_editor.lua:0: nvim_exec2(): Vim(split):E5248: Invalid character in group name
stack traceback:
        [C]: in function 'nvim_exec2'
        vim/_editor.lua: in function 'cmd'
        .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:323: in function 'show'
        .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:611: in function 'create'
        ...cal/share/nvim/lazy/neogit/lua/neogit/lib/popup/init.lua:357: in function 'show'
        ...share/nvim/lazy/neogit/lua/neogit/popups/commit/init.lua:36: in function 'p'
        ...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:1039: in function 'f'
        ....local/share/nvim/lazy/neogit/lua/neogit/popups/init.lua:17: in function 'cb'
        .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:643: in function <.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:642>

Peek 2024-04-28 23-32

petobens commented 3 months ago

Hi @CKolkey. Just to followup, after https://github.com/NeogitOrg/neogit/pull/978/commits/183212cf217f4741266f7a767740ca43deacc7b4 both ii) and iii) of my last comment are fixed :)

However I do notice that i) is still not working. In fact, as it can be seen in the GIF, there is no "autorefresh" after any of the following: writing a file, commiting it, pushing. In each case I need to press <C-r> for the status buffer to refresh. In particular i think it would be really useful to have such autorefresh behavoir since it avoids having the "Commited" and "Pushed to origin/master" messages.

Peek 2024-05-01 16-40