Merge pull request #20 from mihaisucan/master

add a config for RIGHT arrow to accept the suggestion, like in fish
This commit is contained in:
Thiago de Arruda 2014-03-14 08:02:05 -02:00
commit 0cc05bd08e
2 changed files with 7 additions and 1 deletions

1
autosuggestions.plugin.zsh Symbolic link
View File

@ -0,0 +1 @@
autosuggestions.zsh

View File

@ -32,6 +32,7 @@ vi-cmd-mode vi-backward-char backward-char backward-word beginning-of-line
history-search-forward history-search-backward up-line-or-history history-search-forward history-search-backward up-line-or-history
history-beginning-search-forward history-beginning-search-backward history-beginning-search-forward history-beginning-search-backward
down-line-or-history history-substring-search-up history-substring-search-down down-line-or-history history-substring-search-up history-substring-search-down
backward-kill-word
) )
ZLE_AUTOSUGGEST_COMPLETION_WIDGETS=( ZLE_AUTOSUGGEST_COMPLETION_WIDGETS=(
@ -234,7 +235,11 @@ autosuggest-tab() {
} }
autosuggest-accept-suggestion() { autosuggest-accept-suggestion() {
zle autosuggest-${WIDGET}-orig "$@" if [[ AUTOSUGGESTION_ACCEPT_RIGHT_ARROW -eq 1 && "$WIDGET" == 'forward-char' ]]; then
zle autosuggest-end-of-line-orig "$@"
else
zle autosuggest-${WIDGET}-orig "$@"
fi
if [[ -n $ZLE_AUTOSUGGESTING ]]; then if [[ -n $ZLE_AUTOSUGGESTING ]]; then
autosuggest-invalidate-highlight-cache autosuggest-invalidate-highlight-cache
autosuggest-highlight-suggested-text autosuggest-highlight-suggested-text