Conversation
Hey @dritter! Good to have you back This is awesome, especially given the discussion in #331 about integrating async into PL9k. Your workflow seems well thought-out. It also sounds like you think migrating what you did to |
Nice, I look forward to trying this out when it is a bit further along. I agree that we should use |
This can be used to find all indices of a segment configured in left or right prompt elements.
I just re-enabled the vi_mode. :) @bhilburn Yep, absolutely. I just had not enough time to play around with zsh-async to know it will fit our needs. But I'll try to integrate it, once the other missing features in this branch are reimplemented again. @Tritlo yep. It is still a very early peek. Thanks for your comments. @wadkar Cool! Thanks for the offer 👍 Much appreciated. |
@dritter I just pulled your branch to give it a go, appart from some flicker it is very promising. I just had to change the |
Wow. There are a lot of typos in the gifs.. :D @cbourgeois good catch! I want |
Looks very promising, but as I say, I'd prefer the segment to be shown partially (maybe just the icon for it, like the GitHub Octocat?) rather than have it invisible until it can be fully rendered. |
Fix > not working on OSX without rm first
- Before, there were no default colors set. - Fix variable scope
Hmm. After looking at the code and pondering it for my self, I don't think that my suggestion is plausible. We don't really know if the segment will render at all before we try to get the output, which is what takes a long time. |
So I made an attempt at integrating |
The post was made 5 years ago. I think a lot has changed since then. We redraw the whole prompt anyway, so I don't think it makes a difference compared to what he's talking about. |
|
@robobenklein Sorry for the late reply. Do you still get the error? |
Update: I tried to dig into the ZSH source, but my C is a bit rusty (no pun intended and quite an understatement - it's basically not existent). My weak theory at this point is that we exceed the internal queue size for traps. But to be sure I need to compile my own ZSH (see INSTALL instructions). Long story short: I would love to see someone with more C skills to have a look on this. |
- Fixed the issues in test/core/prompt.spec - Added `root = true` - Added URL on info about EditorConfig
editorconfig: trim trailing spaces
Make CACHE_DIR safe and XDG compliant
@robobenklein Strange. Could you check the last commit you are on? |
Just tested 27c1a8a Got it working by not loading the normal p9k once. Although it is behaving differently/incorrectly, Here's the difference, with both themes given the same P9K variables: Depicted:
|
This does not work, as we just saved the PID from the last child that was executed. To work correctly it needs to check ALL child processes, but I am not sure if such a guard is necessary.
This is almost a year old. What's the hold up? |
Hi, I have the same issues (slow prompt, ctrl+c sometimes and some errors are displayed). I know it's a hard subject (based on this message for example), I'm not an ZSH expert but if I can do something, what can I do to help ? |
Hey @krostar - Thanks so much for offering to help! I really appreciate it, and we could definitely use your assistance. We are actually starting to hack on some major new developments in the |
Closing this PR. A lot of speed improvements has landed in the |
This PR changes all segments from synchronous to asynchronous
For now, this is just a proof-of-concept and at best an early alpha. So don't expect everything to work right on. There are already some known bugs (see below).
The code is still a mess, but I wanted to start off a discussion as early as possible.
So, what do you think?
Difference to earlier approaches
The key difference is that this PR executes all configured segments asynchronously instead of whole prompts. This has the benefit of re-rendering single segments (like for the vi-segment #319).
Zsh-async integration
Currently there is no zsh-async used in this PR. But I think zsh-async is a great library, that could deal with some of the Heisenbugs introduced with this PR (occasional shell crashes).. So, it is still a good idea to integrate zsh-async IMHO.
Technical description
So the flow is separated in three parts:
powerlevel9k_prepare_prompts
(which is ourprecmd
hook). In this function we callbuild_left_prompt
andbuild_right_prompt
, which invoke the prompt functions asynchronously.prompt_*
functions. At the end they callserialize_segment
which resolves the user overrides and writes it all to cache files.TRAPUSR1
, which callsp9k_build_prompt_from_cache
. In that function all segments are glued together. The trap is called for each segment exiting its child process. So, it gets as often called as you have segments configured. That is the reason why it should be as fast as possible.Known bugs
There are still some things missing:
setopt PROMPT_SUBST
in Prezto (needs to be set manually ATM)next
into this branchOptional: