show more git info on zsh prompt
[ link: zsh-git-prompt | tags: git zsh shell | updated: Sun, 03 Oct 2010 10:32:00 ]
UPDATE: This post was updated (yet again).
UPDATE: I've updated my prompt again.
I have decided to move the user name, host, and full path to the right of the screen, since most of the
time I know those (if you don't use zsh: the right prompt vanishes if the command line is long so to not get
in the way of editing, it also goes away after you execute the command). On the left, I now show the git
state (see below) and the last component of the
The git bits include:
- the name of the current branch;
- the current state of:
- also on the right prompt I highlight (in yellow) the parts of the path that are subdirs of the repository.
And here are my config files:
- .zshrc - just loads files in
- .zsh.d - zsh config split by topic, of those you want to look at this one:
UPDATE: since I originally wrote this, and the previous articles on the topic, several new techniques have been written and some have many cool new features. I recommend checking out this writeup. However, the alternatives seem to be non-caching and thus take a ong time to refresh the prompts on large repositories. As a result, they are not very interesting to me since I tend to work on large projects where calling git status could take a few seconds. If you're still interested in a fast prompt read on...