3 ms·
> I have a ZSH prompt that shows the Git status of the current directory. Entering in a directory that has a Git repo freezes the terminal for several seconds.
by oefrha 6y ago
> I have a ZSH prompt that shows the Git status of the current directory. Entering in a directory that has a Git repo freezes the terminal for several seconds.
For this specific problem, use a prompt that asynchronously updates git status. https://github.com/sindresorhus/pure https://github.com/sindresorhus/pure is an example, and it contains all the primitives you need to implement your own async prompt. Otherwise good luck working on a huge repo like chromium, even on a faster machine.
- EdwardDiego 6y agoYep agree, I found rather OhMyZsh and ZPresto etc. slowed down significantly in larger repos.
- oefrha 6y agoohmyzsh's git status function is utter garbage and has been that way for at least a decade: https://github.com/ohmyzsh/ohmyzsh/commit/8059c0727a09257dc387aa9ba17dc99d1842aa19 https://github.com/ohmyzsh/ohmyzsh/commit/8059c0727a09257dc3... (committed 2010) the function forks 32 times just to do some pattern matching builtin to the shell! Needless to say any theme using that crap is criminally slow. (Edit: It started out forking only 14 times; the number gradually expanded to 32: https://github.com/ohmyzsh/ohmyzsh/blob/d0d01c0bbf32ffe1dc22a66620ca85669c77e6b8/lib/git.zsh#L140-L189 https://github.com/ohmyzsh/ohmyzsh/blob/d0d01c0bbf32ffe1dc22...) To my surprise, it seems the voice of reason finally prevailed, as that crap has been fixed 20 days ago: https://github.com/ohmyzsh/ohmyzsh/commit/1c58a746af7a67f311ee47f97285a855eaf18b5e https://github.com/ohmyzsh/ohmyzsh/commit/1c58a746af7a67f311... (It's still not remotely close to being well-designed.) Prezto's git primitives are solid, but nothing could help you when git itself is slow on a huge repo. Hence the need for async.
- cevn 6y agoI thought this must be the case. Every time I enable oh my zsh git new terminal opens slow by orders of magnitude.
- timdeve 6y agoPrezto default prompt (soren) is async.