zdharma-continuum / fast-syntax-highlighting

Feature-rich syntax highlighting for ZSH
BSD 3-Clause "New" or "Revised" License
1.06k stars 76 forks source link

[bug]: zsh chokes on unbound variables #49

Closed LucasLarson closed 1 year ago

LucasLarson commented 1 year ago

Describe the bug

when zsh’s NO_UNSET option is enabled,[^1] fast-syntax-highlighting begins to needlessly choke zsh

[^1]: setopt nounset/set -u/set -o nounset/zsh -u

Steps to reproduce

run the following

$ git clone https://github.com/zdharma-continuum/fast-syntax-highlighting /tmp/fast-syntax-highlighting
$ cd /tmp/fast-syntax-highlighting
# run any of the following
$ zsh -dfuc 'autoload -Uz compinit add-zsh-hook; compinit; add-zsh-hook preexec _zsh_highlight_preexec_hook; fpath=/tmp/fast-syntax-highlighting; source /tmp/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh'
# or this
$ zsh -dfu /tmp/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
# or this
$ zsh -dfnu /tmp/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh

Expected behavior

[no output]

Screenshots and recordings

No response

Operating System & Version

darwin22.1.0 | apple | x86_64 | x86_64 | x86_64 unknown

Zsh version

zsh 5.9 (x86_64-apple-darwin22.1.0)

Terminal emulator

iTerm Build 3.5.20230323-nightly; xterm-256-color

If using WSL on Windows, which version of WSL

None

Additional context

No response