Open cmacdonnacha opened 4 years ago
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!
works with bash for me - exact same setup does not work with zsh
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.
@danday74 and @cmacdonnacha I updated my comment above to provide a zsh solution that does the same thing as git-aware-prompt.
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 🤞
Does this work with zsh?