-
Notifications
You must be signed in to change notification settings - Fork 22
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
Question: Can we make PS1 async? #18
Comments
What are you thinking? Like use an alternate prompt until powerline-rs is done? |
I don't know but, it seems that if we could make PS1 somehow be loaded asynchronously the responsiveness of the shell could be improved. It is not an issue with this project though. FYI, I recently stopped showing git info on my powerline because it was not responsive, I wanted it to be faster so now I am using Thanks for the great work of putting this together! |
I've also found the git integration slow with powerline-rs. I've tried updating the |
Yes, |
Looks like the underlying libgit2 is the issue - https://github.com/libgit2/libgit2/issues?q=is%3Aissue+is%3Aopen+slow |
Yes, precisely why I've not been able to fix it |
Seems like changes are on their way! libgit2/libgit2#4230 :) |
Unfortunately that issue has been open for years but little forward motion. I've been trying to work out how to pull in the fork that has better performance. https://crates.io/crates/git2 pulls in https://crates.io/crates/libgit2-sys as a dependency. From that crates repo https://github.com/rust-lang/git2-rs#version-of-libgit2
It looks like https://github.com/rust-lang/git2-rs/tree/master/libgit2-sys then pulls in the libgit2 library pinned to https://github.com/libgit2/libgit2/tree/86b85492b1bc8eeb9ff1af25b92877969f17833a So maybe I should attempt to fork libgit2-sys to point to the higher performance fork at https://github.com/romkatv/libgit2 somehow? |
Good work digging through! Let me help you with that last bit: Yes, you could update the submodule for sure. Using |
As a workaround, in zsh I use powerline-rs without git status on PROMPT, and the git status in RPROMPT asynchronously with the following snippet in # Remove the trailing space in RPROMPT. Used for compat
# with older terminals that would span a newline.
ZLE_RPROMPT_INDENT=0
# Async solution found at https://unix.stackexchange.com/a/645949 :
async_rprompt_callback() {
RPROMPT="$(<&$1)"
zle reset-prompt
zle -F $1
}
async_rprompt() {
# At first tell the current permissions in rprompt.
RPROMPT="$(powerline-rs --rtl --shell zsh --modules perms)"
# Then asynchronously check the git details.
exec {FD}< <(
powerline-rs --rtl --shell zsh --modules perms,git,gitstage
)
zle -F $FD async_rprompt_callback
}
powerline_prompt() {
PROMPT="$(powerline-rs --shell zsh --cwd-max-depth 2 --modules ssh,host,cwd,root $?)"
async_rprompt
# Let terminals display working dir :
echo -en "\e]2;${PWD/$HOME/~}\a"
}
if $(which powerline-rs); then
precmd_functions+=(powerline_prompt)
else
# call your alternative prompt here
fi It's a bit verbose but it works like a charm - I was able to use it when compiling the linux kernel over and over (huge git repo). |
Is... this going to get an update? |
jD91mZM2 has passed away https://www.redox-os.org/news/open-source-mental-health/ |
Oh, wait, I knew about this; I hadn't realized it was the same guy - that was a little while ago... |
I am very sorry to hear about this.
At the same time it's probably the first time I receive news of a human
whose code I contributed to. I read jackpot51's post with great
interest. If they can read me and hoping it helps, in my life this has
been a step forward humanizing my relation to code ... and to you guys.
BTW powerline has continuously been in service on my machine ; I have
no need for any enhancement to it now, but will try to help if need
arises.
Le vendredi 14 octobre 2022 à 05:55 -0700, Artturi a écrit :
… > Is... this going to get an update?
jD91mZM2 has passed away
https://www.redox-os.org/news/open-source-mental-health/
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID:
***@***.***>
|
It might be a stretch but things would be way smoother.
The text was updated successfully, but these errors were encountered: