pure-fish / pure

Pretty, minimal, and fast prompt for Fish shell inspired by sindresorhus/pure
https://pure-fish.github.io/pure/
MIT License
1.25k stars 132 forks source link

Git async #56

Closed Grafikart closed 4 years ago

Grafikart commented 7 years ago

First I want to thanks you for this prompt, it looks really nice. But I have one issue when working on very slow hard drive, the shell freezes when entering a new directory (when pure tries to fetch git informations). Do you think it would be possible to retrieve git information asynchronously like the original pure does ?

I have no knowledge on how prompt works, so feel free to close this issue if this change requires a tons of work ;)

rafaelrinaldi commented 6 years ago

@Grafikart Hey, thank you for using the project and for your interest in making it better! This is a great idea and I thought about it myself. The problem is that as far as I know fish doesn't support running multiple processes in parallel. There are a few hacks I can think of so it might be worth a shot.

Feel free to give it a try. Whenever I find the time I will also work on it, we can plan for the 2.1 release next year.

maxmilton commented 6 years ago

The async git functionality is one of the things that really drew me to the original pure back when I used zsh. Would be amazing to see it in this project.

tkadur commented 6 years ago

Until this happens, could we get an option to disable the git features? I'm experiencing slowdowns due to pure, and this is likely the cause.

I can give it a shot, though I don't have much experience with this sort of thing so the quality of my contribution might not be great.

maxmilton commented 6 years ago

@tkadur good idea! I would be interested in such a feature too. I manage my git repos separately, the CLI prompt is more of a visual cue or quick reminder anyway.

maxmilton commented 6 years ago

I've since found and switched to a different port of the pure theme — https://github.com/vkovtash/pure. It took a little tweaking to get it working but it may be worth looking into for ideas about async git functionality.

EDIT: I ended up creating my own theme based on that other project + adding some ideas from here + fixing some performance issues - https://github.com/MaxMilton/pure

rafaelrinaldi commented 6 years ago

@MaxMilton Would you be willing to help us add async support to this project? I'd love to join forces to get this in. Your effort would be much appreciated (already is!).

Grafikart commented 6 years ago

Just a small warning about the port. If you use an passphrase for your SSH key, it will ask you the passphrase when reaching a directory with a remote repository (passphrase that you won't be able to enter since it's requested by the theme process).

andreiborisov commented 5 years ago

I'll try to implement it. You can assign me.

edouard-lopez commented 5 years ago

@schrodincat I pinged @rafaelrinaldi to do it, I don't enough privileges on the repo.

rafaelrinaldi commented 5 years ago

@schrodincat @edouard-lopez I am not sure what else I can do? I gave all the admins full privilege on GitHub as far as I can tell. Help?

edouard-lopez commented 5 years ago

@schrodincat sorry for the delay, I'm working on #96 to add tests prior to new PRs

edouard-lopez commented 5 years ago

@tkadur adding a feature flag to disable git is a good idea as async support is more complex.

The feature can be implemented by:

  1. add a new pure_enable_git options in conf.d/pure.fish (default to true)
  2. updating _pure_prompt_git.fish
  3. add test cases for that in tests/_pure_prompt_git.test.fish

@MaxMilton Thanks for the link, might help implementing async support.

andreiborisov commented 5 years ago

adding a feature flag to disable git is a good idea

It'll be quite a while before we add git async (I haven't even started to work on it yet) so it makes perfect sense

edouard-lopez commented 5 years ago

The acomagu/fish-async-prompt look quite promising to this feature.

edouard-lopez commented 5 years ago

As discussed in #74 we postponed the integration of this feature after the release of 2.0.0.

In the meantime, PR are welcome so we can discuss code and move forward :zap:

novadev94 commented 4 years ago

Anyone checking this issue in 2020. There's a simple solution currently using https://github.com/acomagu/fish-async-prompt

fisher add acomagu/fish-async-prompt

and put this in your config.fish (or anywhere you want)

set -g async_prompt_functions _pure_prompt_git
gpanders commented 4 years ago

We can add fish-async-prompt as a dependency using a fishfile.

andreiborisov commented 4 years ago

@NovaDev94 @gpanders thanks for the link! I’m going to look into this project and try to reimplement it manually for Git part of pure, since we need to support Oh My Fish!, manual install methods and cannot use dependencies via fishfile.

gpanders commented 4 years ago

since we need to support Oh My Fish!, manual install methods and cannot use dependencies via fishfile.

Of course, I should have thought of that. I got caught up in my own use case.

edouard-lopez commented 4 years ago

@NovaDev94 solution is quite simple and configuration only, so nothing to add in pure.

I'm closing

bdarcus commented 3 years ago

@NovaDev94 solution is quite simple and configuration only, so nothing to add in pure.

Could be helpful to add this solution to the configuration section of the README.

edouard-lopez commented 3 years ago

@bdarcus would you care submitting a pull-request ?

bdarcus commented 3 years ago

I did consider that, but wasn't sure where best to put it.

But I can also add one, and you can adjust.