Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we bring the fugitive_autoreload_status setting back? #2207

Open
brookhong opened this issue Aug 27, 2023 · 5 comments
Open

Can we bring the fugitive_autoreload_status setting back? #2207

brookhong opened this issue Aug 27, 2023 · 5 comments

Comments

@brookhong
Copy link

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

return get(g:, 'fugitive_autoreload_status', !has('win32'))
.

@tpope
Copy link
Owner

tpope commented Sep 3, 2023

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?

@brookhong
Copy link
Author

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.

tpope added a commit that referenced this issue Sep 7, 2023
Best I can tell the ability to pass a line number or tab number argument
has never been used.

Cleaning this up in anticipating of adding actually useful arguments,
and in anticipation of that, I'm preemptively making ReloadWinStatus()
blindly relay any arguments to ReloadStatusBuffer().

References: #2207
tpope added a commit that referenced this issue Sep 7, 2023
The second reload was short-circuited by a reltime() check, so no big
deal, but it does get in the way when trying to make the reload
conditional.

References: #2207
tpope added a commit that referenced this issue Sep 18, 2023
This should improve performance on large repositories.

References: #2207
@tpope
Copy link
Owner

tpope commented Feb 13, 2024

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.

@brookhong
Copy link
Author

brookhong commented Feb 23, 2024

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).

@tpope
Copy link
Owner

tpope commented Feb 23, 2024

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

let g:fugitive_focus_gained = v:false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants