Open felippemr opened 4 years ago
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 gitmux
to show the info on my tmux window. Since it is not part of PS1, my terminal does not hang while powerline is building my PS1.
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 git2
dependency to to the latest 0.13.6
but haven't noticed any appreciable difference - https://github.com/jD91mZM2/powerline-rs/blob/master/Cargo.toml#L29. The biggest slowdown is on large complex repos like https://github.com/envoyproxy/envoy
Yes, git2
seems to be incredibly slow at large repos, not sure why :(
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! https://github.com/libgit2/libgit2/issues/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
The source for libgit2 is included in the libgit2-sys crate so there's no need to pre-install the libgit2 library, the libgit2-sys crate will figure that and/or build that for you.
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?
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 [patch]
sections in Cargo.toml, you can recursively override libraries of your choice from any binary. But it seems like you can also just install the libgit2
fork on your system, and git2-rs will recognize that it doesn't need to compile the code itself :) source
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 ~/.zshrc
:
# 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?
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... Ugh, I feel bad :man_facepalming:
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.