You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh
index f691051..505fe3c 100644
--- a/highlighters/main/main-highlighter.zsh+++ b/highlighters/main/main-highlighter.zsh@@ -196,6 +196,8 @@ _zsh_highlight_main__type() {
REPLY=builtin
elif (( $+commands[(e)$1] )); then
REPLY=command
+ elif (( $+nameddirs[(e)$1] )) && [[ -x $nameddirs[$1] ]]; then+ REPLY=hashed
# None of the special hashes had a match, so fall back to 'type -w', for
# forward compatibility with future versions of zsh that may add new command
# types.
And get these results:
Though I'm not sure if that's the right approach, or whether that addresses it in the right place.
Additionally,cdablevars appears to also not be respected (not sure whether this should be moved to a new issue but these both seem related so I'll keep it here)
Even with my patch above, it only is able to partially addresses this, since it appears that after entering into that directory, only then does it update the hash table (and once the hash table is updated, it gets highlighted, as shown below)
I think the right place to add the check would be in _zsh_highlight_main_highlighter_check_path where autocd is handled currently. To check the user's cdablevars setting you can use the zsyh_user_options array as done at the top of that function for autocd.
Ah, thanks. Looks like my fix can do the following only:
make it such that a command positioned hashed directory name is highlighted as a hashed-command (given autocd and cdablevars of course).
That addresses half of what this issue presents, since now just the hashed directory will be highlighted, as expected
But if you hit tab and allow it to expand into a path, then it does not get highlighted as expected
It feels like this could be made easier if _zsh_highlight_main_highlighter_expand_path handled this instead, but I'm not sure if expansion alone can resolve a hashed directory name
Anyhow, I think I'll PR the fix I described above. If it's on the right path, it could be merged. If it's considered incomplete, then it could be worked on further. And if the approach is wrong (e.g. needs to be addressed in _zsh_highlight_main_highlighter_expand_path instead), then it can be closed.
Screenshot:
I was able to fix it with this
And get these results:
Though I'm not sure if that's the right approach, or whether that addresses it in the right place.
Additionally,
cdablevars
appears to also not be respected (not sure whether this should be moved to a new issue but these both seem related so I'll keep it here)Even with my patch above, it only is able to partially addresses this, since it appears that after entering into that directory, only then does it update the hash table (and once the hash table is updated, it gets highlighted, as shown below)
The text was updated successfully, but these errors were encountered: