zsh-users / zsh-syntax-highlighting

Fish shell like syntax highlighting for Zsh.
github.com/zsh-users/zsh-syntax-highlighting
BSD 3-Clause "New" or "Revised" License
19.5k stars 1.32k forks source link

Repeating source zsh-syntax-highlighting.zsh becomes slow #906

Open jrowlingson opened 1 year ago

jrowlingson commented 1 year ago

:wave: cool project! I've noticed that when re-sourcing zsh-syntax-highlighting.zsh the prompt will take longer each time to initialize. I happened to notice this as I was iterating on my config and repeatedly reloading .zshrc.

To reproduce:

I have the following alias that I use to reload my config:

alias rl='RELOAD=1 source ~/.zshrc'

This alias will become progressively slower when the following is added to my .zshrc:

source /path_to_repo/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

System info:

zsh-syntax-highlighting#b2c910a
$ zsh --version
zsh 5.8 (x86_64-ubuntu-linux-gnu)
danielshahaf commented 1 year ago

:wave: cool project! I've noticed that when re-sourcing zsh-syntax-highlighting.zsh the prompt will take longer each time to initialize. I happened to notice this as I was iterating on my config and repeatedly reloading .zshrc.

To reproduce:

I have the following alias that I use to reload my config:

alias rl='RELOAD=1 source ~/.zshrc'

This command will become progressively slower when the following is added to my .zshrc:

source /path_to_repo/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

If you source z-sy-h.zsh twice, syntax highlighting will be computed twice. That's by design.