olivierverdier / zsh-git-prompt

Informative git prompt for zsh
MIT License
1.72k stars 395 forks source link

Update README.md #138

Open voltuer opened 4 years ago

voltuer commented 4 years ago

The original PROMPT example looks weird when outside a git repo. Example: air~(:|✔) % This new example makes the prompt look like original zsh when outside a git repo. Example: seb@air ~ %

thomasrebele commented 4 years ago

This has probably been fixed in the currently maintained fork. See https://github.com/zsh-git-prompt/zsh-git-prompt Contributions are welcome!

voltuer commented 4 years ago

This has probably been fixed in the currently maintained fork. See https://github.com/zsh-git-prompt/zsh-git-prompt Contributions are welcome!

it's not a bug, it's a usage suggestion:

    git_prompt() {
      if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then echo '%B%m%~%b'$(git_super_status)' %# '
      else echo '%n@%m %1~ %# '
      fi
    }
    PROMPT='$(git_prompt)'
thomasrebele commented 4 years ago

Indeed, this would allow to have custom prompts depending on whether the current working directory is within a git repository.

A similar check is done in https://github.com/zsh-git-prompt/zsh-git-prompt at gitstatus.sh line 15. So the new version should not appear as air~(:|✔) % in the first place.

thomasrebele commented 1 year ago

@JOJ0, I think this repo is abandoned. You might have a better chance with https://github.com/zsh-git-prompt/zsh-git-prompt.