More efficient way to look for elements in arrays
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
This commit is contained in:
parent
3abf463753
commit
2f0fb81af4
@ -200,9 +200,7 @@ _zsh_main-highlight() {
|
|||||||
*': reserved') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];;
|
*': reserved') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];;
|
||||||
*': alias') style=$ZSH_HIGHLIGHT_STYLES[alias]
|
*': alias') style=$ZSH_HIGHLIGHT_STYLES[alias]
|
||||||
local aliased_command="${"$(alias $arg)"#*=}"
|
local aliased_command="${"$(alias $arg)"#*=}"
|
||||||
if [[ ${${ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS[(r)$aliased_command]:-}:+yes} = 'yes' && ${${ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS[(r)$arg]:-}:+yes} != 'yes' ]]; then
|
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$aliased_command"} && -z ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS+=($arg)
|
||||||
ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS+=($arg)
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*': builtin') style=$ZSH_HIGHLIGHT_STYLES[builtin];;
|
*': builtin') style=$ZSH_HIGHLIGHT_STYLES[builtin];;
|
||||||
*': function') style=$ZSH_HIGHLIGHT_STYLES[function];;
|
*': function') style=$ZSH_HIGHLIGHT_STYLES[function];;
|
||||||
@ -243,7 +241,7 @@ _zsh_main-highlight() {
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
[[ $substr_color = 0 ]] && region_highlight+=("$start_pos $end_pos $style")
|
[[ $substr_color = 0 ]] && region_highlight+=("$start_pos $end_pos $style")
|
||||||
[[ ${${ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS[(r)${arg//|/\|}]:-}:+yes} = 'yes' ]] && new_expression=true
|
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && new_expression=true
|
||||||
start_pos=$end_pos
|
start_pos=$end_pos
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user