You are not logged in.
I followed instructions on the wiki page for git copied the git-promp.sh to my home dir, source it .zshrc and then added the variables to my prompt. The git status prompt does not update when I switch in or out of a directory or execute a command, but it does properly update if I source the .zshrc file manualy.
Shouldn't it update on every command or did i miss something?
Last edited by livinglifeback (2013-05-02 01:52:59)
Offline
It depends how the variables are used in your zshrc. As a basher, I don't remember exactly what they are called, but there are functions that are run before each command - you need to define your prompt there. Also improper quoting will make these variables only be expanded once when the file is read rather than every time the prompt is evaluated.
I suspect the latter is the problem - but in either casse, posting the relevant part of your zshrc will sort it out.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Sorry for taking so long to responding.
My prompt which I suppose would be an example of improper quoting is:
PROMPT="%{$terminfo[bold]%}%{$fg[blue]%}[%m]%{$fg[magenta]%}%1~%{$fg[green]%}$(__git_ps1 " (%s)")%{$fg[blue]%}>>%{$reset_color%} "Switching either set of quotes to single quotes doesn't fix the issue.
How do I go about setting it to run after every command?
Offline
google quickly gave me this: http://unix.stackexchange.com/questions … the-prompt
The `setopt prompt_subst` looks to be exactly what you need - but as a non-zsh'er I can't verify this myself.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks, it was a combination of problems I solved it with
local gitval='%{$fg[green]%}$(__git_ps1 " (%s)")'
PROMPT="%{$terminfo[bold]%}%{$fg[blue]%}[%m]%{$fg[magenta]%}%1~${gitval}%{$fg[blue]%}>>%{$reset_color%} "
setopt promptsubstOffline