Skip to content

Commit

Permalink
Improve accuracy of ZLE flag handling
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonrichert committed Jun 20, 2021
1 parent 83b1cfc commit fbc7fce
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions module/.autocomplete.compinit
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ compdef() {

.autocomplete.compinit.precmd() {
[[ -z $CDPATH ]] &&
unset cdpath CDPATH
unset CDPATH cdpath

# Decrease Oh My Zsh start-up time. See below.
[[ -v ZSH_COMPDUMP ]] &&
Expand Down Expand Up @@ -48,13 +48,13 @@ compdef() {
fi

if ! [[ -v _comp_setup && -f $_comp_dumpfile ]]; then
unfunction compdef compinit 2>/dev/null
unfunction compdef compinit 2> /dev/null
builtin autoload -Uz compinit
compinit -C -d $_comp_dumpfile

# Prevent Oh My Zsh from deleting comp dump file.
(( $#omzdump > 0 )) &&
tee -a "$ZSH_COMPDUMP" &>/dev/null <<EOF
tee -a "$ZSH_COMPDUMP" &> /dev/null <<EOF
$omzdump[-2]
$omzdump[-1]
EOF
Expand Down Expand Up @@ -82,7 +82,7 @@ EOF
)
.autocomplete.compinit.zle-f() {
exec {1}<&-
zle -F $1 2>/dev/null
zle -F $1 2> /dev/null
unfunction ${(%):-%N}
}
zle -F "$fd" .autocomplete.compinit.zle-f
Expand Down
2 changes: 1 addition & 1 deletion module/.autocomplete.config
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ zstyle ':completion:*:history-lines' format ''

zstyle ':completion:*' auto-description '%d'
zstyle ':completion:*:parameters' extra-verbose yes
zstyle ':completion:*:default' select-prompt '%F{black}%K{14}line %l (%p)%f%k'
zstyle ':completion:*:default' select-prompt '%F{black}%K{14}line %l %p%f%k'

zstyle ':completion:*' insert-sections yes
zstyle ':completion:*' separate-sections yes
2 changes: 1 addition & 1 deletion module/.autocomplete.widget
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ zmodload zsh/complist
done
.autocomplete.widget.c reverse-menu-complete reverse-menu-complete complete-word

# Declare these again, because compinit overrides them. See below.
# Declare these again (see below), because compinit overrides some of them.
.autocomplete.widget.non-tab

unfunction .autocomplete.widget.c .autocomplete.widget.z
Expand Down
18 changes: 9 additions & 9 deletions utility/.autocomplete.zle-flags
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ emulate -L zsh; setopt $_autocomplete__options

# If no arg, assume same widget as last time.
[[ -n $1 ]] &&
typeset -gH _autocomplete__last_widget="$1"
typeset -gH _autocomplete__last_widget="$1"

# Return 0 to continue, 1 to abort.
case $_autocomplete__last_widget in
*kill* )
( *kill-*~vi-* )
zle -f kill
return 0
;;
*yank* | bracketed-paste | put-after )
;;
( *yank*~vi-* | vi-*put-*after | bracketed-paste )
zle -f yank
return 1
;;
put-before )
;;
( vi-*put-*before )
zle -f yankbefore
return 1
;;
* )
;;
( * )
return 0
;;
;;
esac

0 comments on commit fbc7fce

Please sign in to comment.