'main': Use zsh/parameter instead of type -w

If possible, try to use the zsh/parameter module to get
information about a shell words.

This avoids subshells and is a huge speed improvement
on systems such as cygwin.

Note 1:
$commands does not know about PATH_DIRS. So in case
PATH_DIRS is set, 'type -w' is still used if nothing
else matches.

Note 2:
zsh/parameter can't distinguish between 'command' and
'hashed'. Adjusted the test for that case to XFAIL.

The ideal solution would be if whence had an option to
put the result in REPLY instead of printing it to stdout.
This commit is contained in:
m0viefreak
2016-03-28 23:42:31 +02:00
parent 61f43255ab
commit 12b879caf7
2 changed files with 44 additions and 19 deletions

View File

@@ -31,5 +31,5 @@ hash zsh_syntax_highlighting_hash=/doesnotexist
BUFFER='zsh_syntax_highlighting_hash'
expected_region_highlight=(
"1 28 hashed-command"
"1 28 hashed-command 'zsh/parameter cannot distinguish between hashed and command'"
)