I remember having a very confusing bash code to get the last exit code on my prompt and a somewhat messy code to get the git branch name and status to color it accordingly. When I decided to try zsh I was delighted to learn that it has some very usefull builtins, like vcs_info_msg_0_ and the %? that gets the last exit code. My prompt is not as minimalistic as yours, but I guess I'm going to go more minimal for a few days and see if I like it.
Worth saying that %0(?..%?) will show the last exit code but only if it was not 0. You can even style it like %0(?.. %F{green} exit code: <%?> %f) and so on.
I don't know how to upload images here, please help 😅
Branch in light blue: something in staging area (can commit)
The error code appears in purple and inside brackets
There are also some experimental things, like highlighting, underlining and putting the letter D before the branch when the local branch is ahead, behind or have diverged, but they don't seem to work all that well.
Here is the code I used to get this prompt.
I actually like a lot the different colors for different states of the repo.
Really nice!
I remember having a very confusing bash code to get the last exit code on my prompt and a somewhat messy code to get the git branch name and status to color it accordingly. When I decided to try zsh I was delighted to learn that it has some very usefull builtins, like
vcs_info_msg_0_and the%?that gets the last exit code. My prompt is not as minimalistic as yours, but I guess I'm going to go more minimal for a few days and see if I like it.Worth saying that
%0(?..%?)will show the last exit code but only if it was not 0. You can even style it like%0(?.. %F{green} exit code: <%?> %f)and so on.I don't know how to upload images here, please help 😅
dev-to-uploads.s3.amazonaws.com/up...
There are also some experimental things, like highlighting, underlining and putting the letter D before the branch when the local branch is ahead, behind or have diverged, but they don't seem to work all that well.
Here is the code I used to get this prompt.
I actually like a lot the different colors for different states of the repo.
gist.github.com/lucassperez/bc04af...
Oh whoa that is so cool!! Thank you for sharing!