45 lines
954 B
Text
45 lines
954 B
Text
#autoload
|
|
|
|
[[ $_comp_tags == *\ (history-lines|recent-)* ]] &&
|
|
return 1
|
|
|
|
# Is not going to be correct.
|
|
[[ -v _autocomplete__partial_list ]] &&
|
|
return 1
|
|
|
|
# No need to update.
|
|
[[ $compstate[old_list] == keep ]] &&
|
|
return 1
|
|
|
|
# Doesn't make sense to show.
|
|
(( compstate[nmatches] < 2 )) &&
|
|
return 1
|
|
|
|
# Nothing to insert.
|
|
[[ -z $compstate[unambiguous] ]] &&
|
|
return 1
|
|
|
|
# Substring is already present.
|
|
local -P word=$IPREFIX$PREFIX$SUFFIX$ISUFFIX
|
|
[[ -n $word && $word == *$compstate[unambiguous]* ]] &&
|
|
return 1
|
|
|
|
local -P tag=unambiguous
|
|
_tags $tag
|
|
_tags ||
|
|
return
|
|
_requested $tag ||
|
|
return
|
|
|
|
typeset -g _autocomplete__unambiguous="$compstate[unambiguous]"
|
|
|
|
# Retrieve highlight value.
|
|
local format
|
|
zstyle -s ":completion:${curcontext}:unambiguous" format format ||
|
|
format=$'%{\e[0;2m%}%Bcommon substring:%b %0F%11K%d%f%k'
|
|
|
|
zformat -F format "$format" "d:$compstate[unambiguous]"
|
|
|
|
builtin compadd -J "$tag" -x "$format"
|
|
|
|
false
|