-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ece9083
commit 6d059a3
Showing
2 changed files
with
54 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,57 @@ | ||
#autoload | ||
|
||
local -a match=() mbegin=() mend=() # `zstyle` for some reason assigns these. | ||
|
||
unset MENUMODE MENUSELECT | ||
compstate[insert]= | ||
compstate[list]= | ||
compstate[restore]= | ||
|
||
if [[ $_completer == _prefix ]]; then | ||
compstate[to_end]= | ||
else | ||
compstate[to_end]='always' | ||
fi | ||
|
||
if _autocomplete__should_insert_unambiguous; then | ||
|
||
[[ $WIDGETSTYLE == (|*-)menu(|-*) ]] && | ||
compstate[insert]='automenu-' | ||
|
||
if [[ $WIDGETSTYLE == (|*-)menu(|-*) ]]; then | ||
compstate[insert]='automenu-' | ||
else | ||
compstate[insert]= | ||
fi | ||
compstate[insert]+='unambiguous' | ||
|
||
compstate[list]='list force' | ||
unset _autocomplete__unambiguous | ||
|
||
return # ! | ||
fi | ||
|
||
local -Pa comptags=() | ||
local -Pi nmatches=0 | ||
|
||
if [[ $compstate[old_list] == keep ]]; then | ||
comptags=( $=_lastcomp[tags] ) | ||
nmatches=$_lastcomp[nmatches] | ||
else | ||
comptags=( $=_comp_tags ) | ||
nmatches=$compstate[nmatches] | ||
fi | ||
|
||
if (( nmatches > 1 )); then | ||
if [[ $WIDGETSTYLE == (|*-)menu(|-*) ]]; then | ||
compstate[insert]='menu:' | ||
if (( nmatches <= LINES - BUFFERLINES - 1 )); then | ||
compstate[list]='list packed rows' | ||
else | ||
builtin zle -Rc | ||
if [[ $WIDGETSTYLE == (|*-)select(|-*) ]]; then | ||
typeset -gi MENUSELECT=0 | ||
if [[ $WIDGET == (|*-)search(|-*) ]]; then | ||
typeset -g MENUMODE=search-forward | ||
fi | ||
fi | ||
compstate[insert]='menu:' | ||
compstate[list]='list force' | ||
else | ||
compstate[insert]= | ||
compstate[list]= | ||
zle -Rc | ||
fi | ||
if [[ $WIDGET == (|*-)search(|-*) ]]; then | ||
MENUMODE=search-forward | ||
if [[ $WIDGET == (|.)reverse-* || $WIDGETSTYLE == (|.)reverse-menu-complete ]]; then | ||
compstate[insert]+='0' | ||
else | ||
compstate[insert]+='1' | ||
fi | ||
if [[ $WIDGETSTYLE == (|*-)select(|-*) ]]; then | ||
typeset -gi MENUSELECT=0 | ||
|
||
local -Pa comptags=() | ||
if [[ $compstate[old_list] == keep ]]; then | ||
comptags=( $=_lastcomp[tags] ) | ||
else | ||
comptags=( $=_comp_tags ) | ||
fi | ||
fi | ||
|
||
if [[ $WIDGET == (|.)reverse-* || $WIDGETSTYLE == (|.)reverse-menu-complete ]]; then | ||
compstate[insert]+='0' | ||
else | ||
compstate[insert]+='1' | ||
fi | ||
local -a spacetags=() | ||
builtin zstyle -a :autocomplete: add-space spacetags || | ||
spacetags=( executables aliases functions builtins reserved-words commands ) | ||
|
||
local -a spacetags=() | ||
builtin zstyle -a :autocomplete: add-space spacetags || | ||
spacetags=( executables aliases functions builtins reserved-words commands ) | ||
[[ -n ${comptags:*spacetags} ]] && | ||
compstate[insert]+=' ' | ||
[[ -n ${comptags:*spacetags} ]] && | ||
compstate[insert]+=' ' | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters