-
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the handling of kill/yank sequences
- Loading branch information
1 parent
0c392fe
commit f3fdcfa
Showing
1 changed file
with
13 additions
and
35 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,36 +1,14 @@ | ||
#!/bin/zsh | ||
typeset -g _autocomplete__last_widget= | ||
|
||
.autocomplete__zle-flags() { | ||
emulate -L zsh | ||
setopt $_autocomplete__func_opts[@] | ||
|
||
# If no arg, assume same widget as last time. | ||
[[ -v 1 && -n $1 ]] && | ||
typeset -g _autocomplete__last_widget="$1" | ||
|
||
# Return 0 to continue, 1 to abort. | ||
case $_autocomplete__last_widget in | ||
( *kill-*~vi-* ) | ||
builtin zle -f kill | ||
return 0 | ||
;; | ||
( bracketed-paste ) | ||
builtin zle -f yank | ||
return 0 | ||
;; | ||
( *yank*~vi-* | vi-*put-*after ) | ||
builtin zle -f yank | ||
return 1 | ||
;; | ||
( vi-*put-*before ) | ||
builtin zle -f yankbefore | ||
return 1 | ||
;; | ||
( * ) | ||
return 0 | ||
;; | ||
esac | ||
} | ||
|
||
.autocomplete__zle-flags "$@" | ||
emulate -L zsh | ||
setopt $_autocomplete__func_opts[@] | ||
|
||
if (( YANK_ACTIVE )); then | ||
local before | ||
(( YANK_START <= CURSOR && YANK_END <= CURSOR )) && | ||
before=before | ||
builtin zle -f yank$before | ||
return 1 # Tell caller to abort. | ||
fi | ||
|
||
builtin zle -f kill | ||
return 0 |