I love oh-my-zsh!!
However, I have to work with a relatively large Git repository. This means, once navigate into this Git repo via the ZSH command line, each time the prompt is painted, there is a painful 2-3 sec wait. This doesn’t sound like much, but it really gets in the way of the flow of work when it continuously happens over several hours of work.
I am using the sunrise oh-my-zsh theme and the zsh prompt with this theme displays both the current Git branch and the dirty state of the repo. I had a strong inkling the latter dirty state computation was the culprit causing the slowness for me.
Looking into the ~/.oh-my-zsh/themes/sunrise.zsh.theme file, I found the custom_git_function() which is responsible for constructing the command prompt. The actual line of interest looks like:
The parse_git_dirty, git_prompt_ahead and custom_git_prompt_status sections seemed like the problem. For me, all I want to know is the current branch. I really don’t care about these status flags.
I dropped these three status sections, resulting in a line like:
I saved this change to sunrise.zsh.theme file and re-launched my ZSH command prompt.
Voila! Speedy painting of the prompt in my large Git repo.
I am sure there is a cleaner way to override the ZSH prompts specified in an oh-my-zsh theme. If anyone out there knows or can point me to the documentation for this, I’d really appreciate it.