Create a gist now

Instantly share code, notes, and snippets.

The slowness of my zsh prompt when in a git-svn managed directory was killing me. I improved it by removing the git status stuff that slows it down...
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
@rbugajewski

In my theme (robbyrussell) I was missing the ending brace, so I changed the output to echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}${ZSH_THEME_GIT_PROMPT_CLEAN}${ZSH_THEME_GIT_PROMPT_SUFFIX}".

@toc21c
toc21c commented Apr 10, 2013

awesome!!

@akilman
akilman commented May 7, 2013

This has been bugging me for some time now. Thanks!

@admdikramr

This is excellent -- but when I'm not in a git directory, it says (master). Is there an easy way to prevent this?

@rajsahae

Huge huge help. Thank you.

@gferon
gferon commented Oct 22, 2013

I think you should submit a pull request with this fix, so it can be toggled with a setting!

@rekendahl

Thank you. This has been bugging me under CentOS 6 for some time. It is true that what's slow on my system is git status. I wonder if it's a git version thing (CentOS runs a older version) or it it's a git svn thing.

@messick
messick commented Aug 12, 2014

👍

@jbnunn
jbnunn commented Sep 3, 2014

Works on Yosemite as well--thank you!

@n1k0
n1k0 commented Sep 8, 2014

Just to add a thank you to the stack. Cheers!

@kstach01

Thanks! That was driving me insane.

@yonatankarni

great stuff! thanks!

@justinharringa

👍

@retgoat
retgoat commented Apr 23, 2015

Works great! Thanks!

@kwketh
kwketh commented May 22, 2015

Thanks, that looks great.
If anybody is still running into issues, you may trace all commands with set -o xtrace, you will see full context and likely which command may be taking long time. It helped me trace my problem.

@pmalek
pmalek commented May 29, 2015

@kwketh How to undo set -o xtrace?

@pmalek
pmalek commented May 29, 2015

After applying this fix I am missing the * (when I have midified working tree).

@minhoryang

HAPPY TO MEET YOU!

@SSchnitzler

Thank you for this gist, it made working with zsh possible again for me as it was just unusably slow and i had to disable it again.

@songcy6202

That's great ,thanks a lot.

@smeggingsmegger

Still relevant and wonderful. Thanks!

@triadsk
triadsk commented Jan 2, 2016

That worked, thanks a lot!

@HandIeNeeded

Awesome!

@xiaoyang4011

nice!

@usmanayubsh

Works like a charm! Thank you so much.

@dannykopping

👍

@harukaeru

Great!

@smo0f
smo0f commented Nov 11, 2016

@pmalek to undo set -o xtrace, run set +o xtrace - plus instead of minus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment