Skip to content
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

Does this work with zsh? #71

Open
cmacdonnacha opened this issue Aug 25, 2020 · 6 comments
Open

Does this work with zsh? #71

cmacdonnacha opened this issue Aug 25, 2020 · 6 comments

Comments

@cmacdonnacha
Copy link

Does this work with zsh?

@danday74
Copy link

yup I would like to know the answer too

also see - https://stackoverflow.com/questions/65041568/iterm2-use-bash-as-well-as-zsh

I am happy to use zsh but asked this SO question so that if git-aware-prompt only works with bash then I need bash!

@danday74
Copy link

works with bash for me - exact same setup does not work with zsh

@emmahsax
Copy link

emmahsax commented Jun 9, 2021

I can affirm, I just tried switching to zsh, and git-aware-prompt does not work with zsh, but continues to work with bash beautifully.

However, here's a zsh solution (found from various articles and stuff over the internet):

# Load version control information, set git branch, and load colors
autoload -Uz vcs_info
precmd() { vcs_info }
zstyle ':vcs_info:git:*' formats '(%b)'

# Mon Jan 01 13:26:31 ~/path/to/current_dir (git-branch)
# %
setopt PROMPT_SUBST
PROMPT='%B%F{cyan}%D{%a %b %d %H:%M:%S} %F{yellow}${PWD/#$HOME/~} %F{green}${vcs_info_msg_0_}'$'\n''%f%% %b'

I also color my prompt, so the date/time is cyan, the path is yellow, and the branch is green.

@emmahsax
Copy link

emmahsax commented Jun 12, 2021

@danday74 and @cmacdonnacha I updated my comment above to provide a zsh solution that does the same thing as git-aware-prompt.

@jimeh
Copy link
Owner

jimeh commented Jun 13, 2021

I'm afraid git-aware-prompt is very specific to bash right now. For years I have wanted to do a complete rewrite that'll work on both bash and zsh, as I haven't personally used git-aware-prompt since 2011 when I switched to zsh.

And I would very much like to start using my own solution again rather than a third party one. Right now most of my spare time is going towards my emacs-builds project, but I've just bumped the bash+zsh rewrite up into second place on my todo list, so this time I'm hoping I'll actually get around to it 🤞

@joeytwiddle
Copy link

My fork supports zsh, and has a bunch of extra options.

I have also made a PR to add zsh support to this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants