jeremyFreeAgent / oh-my-zsh-powerline-theme

oh-my-zsh Powerline style Theme
1.2k stars 254 forks source link

How to remove the white space when in a no-git directory #64

Open dss886 opened 7 years ago

dss886 commented 7 years ago

When I am in a directory which is not a git repository, there is an white space shown at the end of the prompt.

image

I've tried to uncomment the if-statement in line 109 to line 128, not work.

Also tried the ternary expression as this article:

POWERLINE_GIT_INFO_LEFT=$(("$(git_prompt_info)"=""?1:0))

But end up with : zsh: bad math expression: illegal character: "

My temporary solution is add below lines to my ~/.zshrc:

function newCD(){
    cd $1;
    source "$ZSH/themes/$ZSH_THEME.zsh-theme"
}
alias cd="newCD"

But it seems to so ugly and unstable as I changed the behavior of the default command "cd", so does anyone have a better solution?