diff --git a/docs/highlighters/main.md b/docs/highlighters/main.md index f4507d8..3b0e853 100644 --- a/docs/highlighters/main.md +++ b/docs/highlighters/main.md @@ -85,11 +85,11 @@ manual page][zshzle-Character-Highlighting]. #### Parameters -To avoid partial path lookups on a path, add the path to the `X_ZSH_HIGHLIGHT_DIRS_BLACKLIST` array. +To avoid partial path lookups on a path, add the path to the `ZSH_HIGHLIGHT_DIRS_BLACKLIST` array. This interface is still experimental. ```zsh -X_ZSH_HIGHLIGHT_DIRS_BLACKLIST+=(/mnt/slow_share) +ZSH_HIGHLIGHT_DIRS_BLACKLIST+=(/mnt/slow_share) ``` ### Useless trivia diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 91be6ca..9c80792 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -355,6 +355,12 @@ _zsh_highlight_highlighter_main_paint() '!' # reserved word; unrelated to $histchars[1] ) + if (( $+X_ZSH_HIGHLIGHT_DIRS_BLACKLIST )); then + print >&2 'zsh-syntax-highlighting: X_ZSH_HIGHLIGHT_DIRS_BLACKLIST is deprecated. Please use ZSH_HIGHLIGHT_DIRS_BLACKLIST.' + ZSH_HIGHLIGHT_DIRS_BLACKLIST=($X_ZSH_HIGHLIGHT_DIRS_BLACKLIST) + unset X_ZSH_HIGHLIGHT_DIRS_BLACKLIST + fi + _zsh_highlight_main_highlighter_highlight_list -$#PREBUFFER '' 1 "$PREBUFFER$BUFFER" # end is a reserved word @@ -966,7 +972,7 @@ _zsh_highlight_main_highlighter_check_path() tmp_path=$tmp_path:a while [[ $tmp_path != / ]]; do - [[ -n ${(M)X_ZSH_HIGHLIGHT_DIRS_BLACKLIST:#$tmp_path} ]] && return 1 + [[ -n ${(M)ZSH_HIGHLIGHT_DIRS_BLACKLIST:#$tmp_path} ]] && return 1 tmp_path=$tmp_path:h done @@ -1411,4 +1417,4 @@ else # Make sure the cache is unset unset _zsh_highlight_main__command_type_cache fi -typeset -ga X_ZSH_HIGHLIGHT_DIRS_BLACKLIST +typeset -ga ZSH_HIGHLIGHT_DIRS_BLACKLIST diff --git a/highlighters/main/test-data/dirs_blacklist.zsh b/highlighters/main/test-data/dirs_blacklist.zsh index 8cf04be..2d0222f 100644 --- a/highlighters/main/test-data/dirs_blacklist.zsh +++ b/highlighters/main/test-data/dirs_blacklist.zsh @@ -30,7 +30,7 @@ mkdir foo touch foo/bar BUFFER=": foo/bar $PWD/foo foo/b" -X_ZSH_HIGHLIGHT_DIRS_BLACKLIST=($PWD/foo $PWD/bar) +ZSH_HIGHLIGHT_DIRS_BLACKLIST=($PWD/foo $PWD/bar) expected_region_highlight=( '1 1 builtin' # : diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index df8a1aa..320ce5b 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -432,6 +432,12 @@ zmodload zsh/parameter 2>/dev/null || true # Initialize the array of active highlighters if needed. [[ $#ZSH_HIGHLIGHT_HIGHLIGHTERS -eq 0 ]] && ZSH_HIGHLIGHT_HIGHLIGHTERS=(main) +if (( $+X_ZSH_HIGHLIGHT_DIRS_BLACKLIST )); then + print >&2 'zsh-syntax-highlighting: X_ZSH_HIGHLIGHT_DIRS_BLACKLIST is deprecated. Please use ZSH_HIGHLIGHT_DIRS_BLACKLIST.' + ZSH_HIGHLIGHT_DIRS_BLACKLIST=($X_ZSH_HIGHLIGHT_DIRS_BLACKLIST) + unset X_ZSH_HIGHLIGHT_DIRS_BLACKLIST +fi + # Restore the aliases we unned eval "$zsh_highlight__aliases" builtin unset zsh_highlight__aliases