diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..715e624 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.revision-hash export-subst diff --git a/.revision-hash b/.revision-hash new file mode 100644 index 0000000..6828f88 --- /dev/null +++ b/.revision-hash @@ -0,0 +1 @@ +$Format:%H$ diff --git a/.version b/.version new file mode 100644 index 0000000..0ba2319 --- /dev/null +++ b/.version @@ -0,0 +1 @@ +0.3.0-dev \ No newline at end of file diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index ce9db28..a65b29f 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -29,6 +29,17 @@ # ------------------------------------------------------------------------------------------------- +if [[ -o function_argzero ]]; then + # $0 is reliable + ZSH_HIGHLIGHT_VERSION=$(<"$0:h"/.version) +else + # $0 is unreliable, so the call to _zsh_highlight_load_highlighters will fail. + # TODO: If 'zmodload zsh/parameter' is available, ${funcsourcetrace[1]%:*} might serve as a substitute? + # TODO: also check POSIX_ARGZERO, but not it's not available in older zsh + echo "zsh-syntax-highlighting: error: not compatible with FUNCTION_ARGZERO" >&2 + return 1 +fi + # ------------------------------------------------------------------------------------------------- # Core highlighting update system # -------------------------------------------------------------------------------------------------