vim-fugitive icon indicating copy to clipboard operation
vim-fugitive copied to clipboard

Can we bring the `fugitive_autoreload_status` setting back?

Open brookhong opened this issue 2 years ago • 5 comments

In some large repo, it takes minutes to run git status. Vim freezes frequently if Git window is open.

Is it possible to turn off autoreload_status and let user to refresh status on demand?

This is some related setting https://github.com/tpope/vim-fugitive/blob/5d99841b22928f1597d447c68de844989bf9a804/autoload/fugitive.vim#L2062.

brookhong avatar Aug 27 '23 01:08 brookhong

There's now two kinds of reloading: eager and lazy. Eager immediately reloads any visible Fugitive windows, and is used when you explicitly invoke a Fugitive command that will likely change the status, like :Git add or :Gwrite. Lazy waits to reload until the Fugitive window is in focus, and is used for other things that could potentially change the status, like saving a file or :!.

So it's no longer as simple as a Boolean option, that's why the old option went away. My proposal would be to add an option that makes all reloads lazy. I think if the Fugitive window is in focus, then we should still reload it, otherwise some operations won't work right. Does an option for that sound like it would solve or at least substantially mitigate your problem?

tpope avatar Sep 03 '23 20:09 tpope

Thanks for looking into this.

So if the proposed option is on, it will not reload status after we invoke a Fugitive command unless the Git window is focus?

If yes, that should work as we could mitigate the issue by avoiding switching to the Git window. Additionally it would be better to make the option could be set for a specific repository, since Git status runs fast for most repositories.

brookhong avatar Sep 04 '23 00:09 brookhong

Have you tried git config core.untrackedCache true and/or git config core.fsmonitor true, to see if those improve performance to an acceptable level?

I started working on bring the option back, but then quickly decided I'd rather spend what time I have working on making it async instead. This turned out to be a major project.

tpope avatar Feb 13 '24 02:02 tpope

Those git settings haven't made things better for me.

I might haven't described the issue very well. It is acceptable to reload status when a Fugitive command is invoked with Git window open, the worse part is that it is to reload status when none Fugitive command is invoked, such as switching back to vim/nvim from another app(observed in NVIM v0.9.5 under Mac).

brookhong avatar Feb 23 '24 06:02 brookhong

There is an option to turn off reloads on focusing Vim:

let g:fugitive_focus_gained = v:false

tpope avatar Feb 23 '24 15:02 tpope