Using iTerm2 and-or Terminal on 开发者_开发知识库OSX - Ive got the lastest version of vcprompt installed and working to a point. I cant seem to get the format to reflect modified (+) and uncommitted (?) in my prompt.
i.e.$user: path [git:branch +?]
.
In .bash_login
print_before_prompt (){
printf "\e[0;35m%s: \e[0;36m%s \e[0;33m%s\e[0m \n" "$USER" "$PWD" "$(vcprompt -f %n:%b %u%m)"
}
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
PROMPT_COMMAND=print_before_prompt
PS1="→ "
PS2=" > "
Also added bash.showDirtyState true
in --global git config file
but I dont get the indicators as expected: actually all it does is remove the [ ] from around [git:branch]. $user: path git:branch
I know this is pretty fringe but help on this would be great --
You forgot to specify which vcprompt you're talking about -- I'm the author of the original C version (https://bitbucket.org/gward/vcprompt), but I know of at least two re-implementations which have "borrowed" the name vcprompt. Anyways, I can only answer for my version.
I don't think this feature was implemented for git when you posted your question originally, which would explain why it didn't work back then.
It should be working fine in the latest version of vcprompt (1.1 as I write this, 1.2 coming shortly). I believe vcprompt 1.1 is packaged by homebrew for OS X, so it should be easy to install/upgrade.
精彩评论