-
Notifications
You must be signed in to change notification settings - Fork 1.3k
main: Add ZSH_HIGHLIGHT_DIRS_BLACKLIST #496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Seems |
1fc2082
to
a24d8e3
Compare
0caac8c
to
15e288a
Compare
Merging this to master as an experimental interface. Hopefully this will make testing easier. If positive feedback ensues, the |
We got some feedback in #528 and moved the blacklist check to prior to any syscalls. @danielshahaf do you think that is sufficient to drop the |
@phy1729 Let's see. The feature was added in 0.6.0-89-g6713727 (6713727). On the one hand, that's 18 months ago (a very long time, so far as exposure to users of In light of all these, I guess we can just drop the If you want to make it a zstyle, by the way, that'd work for me — see #362; so long as we put a version number or a format number at the head of the style, that'd raise no forward compatibility issues — but of course, simply renaming the parameter is a lot easier. What will the transition be? Will the code continue to honour |
I would leave changing to a zstyle to later when the rest of the config will be changed as well. Regarding the transition, I was thinking something like the patch below. The notice in zsh-syntax-highlighting.zsh will be nicer to hit as it's prior to drawing the prompt. The notice in main-highlighter.zsh will catch if I would like to put this (and the X_ removal) in now, tag -rc1, and then remove the warnings prior to release in a week. Those who follow master tend to upgrade frequently. Although, I have no objection to lengthening the amount of time this stays in to catch anyone on vacation or otherwise AFK. diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh
index 91be6ca..838ab2c 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 '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
diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh
index df8a1aa..6b75a5e 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 '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 |
+1
That all sounds good, with the caveat you foresaw: I don't know if leaving it in for just a week would be enough. How often do those plugin managers auto-update us?
Should we check not only whether the array is defined but also whether it's not empty? I guess the condition is good as-is, but thought I'd ask.
Let's prefix the output with
What if both variables are set? I don't think we should just overwrite the value of
Thanks. |
Closes #379.
This may fail on symlinks, but I think this should cover most cases. I placed the check below the -L and -e tests so once the file is completely typed it will still highlight as path.
Please test that the speed with this change is usable if you've run into #379. If things are still too slow the check can be moved up (or we could test that the word is no longer being typed with
$CURSOR
and have a cache).I'll add docs after we get some reports and know how
$ZSH_HIGHLIGHT_DIRS_BLACKLIST
will act.