zsh theme for full path + display git changes

You can modify the second line of this file:

~/.oh-my-zsh/themes/robbyrussell.zsh-theme

Which looks like this:

PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
#                       ^ replace c with ~

Then source theme again:

source ~/.zshrc

It will now show the path relative to your home directory (~). For example:

# BEFORE
➜  sqlboiler git:(master)
# AFTER
➜  ~/open-source/sqlboiler git:(master)

Besides other answers,

If you also want to add the username and/or hostname, add the three lines below in the end of ~/.zshrc to overwrite the PROMPT:

PROMPT="%{$fg_bold[white]%}%n %{$fg[blue]%}@ %{$fg_bold[yellow]%}%m"

PROMPT+=" %(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"

PROMPT+=' %{$fg[cyan]%}%d%{$reset_color%} $(git_prompt_info)'

Explanation:

%n is the username

%m is the hostname

%d is the directory (you can replace it with %~)

Note: Space between username and hostname is added in the example above is for clarity, you can remove them if you want.


Run man zshmisc and search for the SIMPLE PROMPT ESCAPES section. This documents escapes which can be used to theme your prompt.

To get the full path path of your current working directory use %d.

I'm assuming you're using oh-my-zsh. In order to accomplish what you want, you can create a modified version of the Godzilla theme and replace the %c (which just shows the current folder) with %d in the PROMPT.

See here: https://github.com/robbyrussell/oh-my-zsh/blob/c78277fd8bda5fec87504469afdf121355876006/themes/gozilla.zsh-theme#L1