dracula / zsh

🧛🏻‍♂️ Dark theme for ZSH
https://draculatheme.com/zsh
MIT License
273 stars 69 forks source link

Time and Git prompt not working #26

Closed AlexisFinn closed 3 years ago

AlexisFinn commented 3 years ago

2020-12-17-091323_646x213_scrot

This is what my propmt looks like when I display time and when I cd into a git repository. So 3 things don't work:

1 - the time format is wrong, that's easy to fix, on L.70 the % was forgottent before the M TIME_FORMAT="%k:M"

2 - the test on L.73 is obvioulsy wrong syntax as it's echoing the result instead of testing (I don't know if the test actually works), this should be pretty easy to correct for anyone familiar with zsh script syntax (I'm not that good, sorry). btw I live in france, so no am_pm for me, I want 24h format but I can't tell if that changes anything if ! locale -ck LC_TIME | grep 'am_pm=";"'; then

3 - And this is the difficult part, as you can see the async_workers are never triggering (I teste with a simple echo "hello" in the callback function and can confirm it's never triggered). The easy fix for this is to install mafredri/zsh-async but this is not listed as a dependency since async.zsh is shipped with this theme and sourced from it, but the shipped version doesn't seem to be working (maybe needs update)

AlexisFinn commented 3 years ago

P.S: looked into the 2 quickly and would guess the test needs to be re-written as such

      # check if locale uses AM and PM
      if [[ ! $(locale -ck LC_TIME | grep 'am_pm=";"') ]]; then
        TIME_FORMAT="%l:%M%p"
      fi

But as stated above I don't use AM/PM where I live, so I can't really tell if it works but at least it stopped echoing the test

avalonwilliams commented 3 years ago

Thanks for the input! I somehow didn't experience those bugs when I wrote the time segment, but I tested it and it should now work with the French locale.

The issue with the git prompt not working is interesting however, because I sourced the theme on my session from a test prompt and it works fine. Could you tell me the version of zsh you're using, the operating system you're on, how you installed the theme, and your zsh configuration?

Often the reason why the async prompt might not show up is because another plugin (or the user configuration) is overriding the precmd command, which we use to start the async process for the prompt. Could you include the output for the command declare -f precmd as well?

avalonwilliams commented 3 years ago

Closing from inactivity.