Compare commits

...

4 Commits

Author SHA1 Message Date
Eric Freese
0faa2b6584 bump version v0.2.9 2016-02-16 09:34:35 -07:00
Eric Freese
a2d8d91196 Actually fix suggestions when sh_split_words option is enabled. 2016-02-16 09:33:26 -07:00
Eric Freese
dd9a8789a7 bump version v0.2.8 2016-02-16 07:59:36 -07:00
Eric Freese
1b98af5b33 Fix suggestions when sh_split_words option is enabled 2016-02-16 07:57:44 -07:00
4 changed files with 8 additions and 18 deletions

View File

@@ -1 +1 @@
v0.2.7 v0.2.9

View File

@@ -8,12 +8,7 @@ _zsh_autosuggest_suggestion() {
setopt localoptions extendedglob setopt localoptions extendedglob
# Escape the prefix (requires EXTENDED_GLOB) # Escape the prefix (requires EXTENDED_GLOB)
local prefix=${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH} local prefix="${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}"
# Get all history items (reversed) that match pattern $prefix* fc -ln -m "$prefix*" 2>/dev/null | tail -1
local history_matches
history_matches=(${history[(R)$prefix*]})
# Echo the first item that matches
echo ${history_matches[1]}
} }

View File

@@ -19,7 +19,7 @@ _zsh_autosuggest_modify() {
# Get a new suggestion if the buffer is not empty after modification # Get a new suggestion if the buffer is not empty after modification
local suggestion local suggestion
if [ $#BUFFER -gt 0 ]; then if [ $#BUFFER -gt 0 ]; then
suggestion=$(_zsh_autosuggest_suggestion $BUFFER) suggestion=$(_zsh_autosuggest_suggestion "$BUFFER")
fi fi
# Add the suggestion to the POSTDISPLAY # Add the suggestion to the POSTDISPLAY

View File

@@ -1,6 +1,6 @@
# Fish-like fast/unobtrusive autosuggestions for zsh. # Fish-like fast/unobtrusive autosuggestions for zsh.
# https://github.com/tarruda/zsh-autosuggestions # https://github.com/tarruda/zsh-autosuggestions
# v0.2.7 # v0.2.9
# Copyright (c) 2013 Thiago de Arruda # Copyright (c) 2013 Thiago de Arruda
# Copyright (c) 2016 Eric Freese # Copyright (c) 2016 Eric Freese
# #
@@ -219,7 +219,7 @@ _zsh_autosuggest_modify() {
# Get a new suggestion if the buffer is not empty after modification # Get a new suggestion if the buffer is not empty after modification
local suggestion local suggestion
if [ $#BUFFER -gt 0 ]; then if [ $#BUFFER -gt 0 ]; then
suggestion=$(_zsh_autosuggest_suggestion $BUFFER) suggestion=$(_zsh_autosuggest_suggestion "$BUFFER")
fi fi
# Add the suggestion to the POSTDISPLAY # Add the suggestion to the POSTDISPLAY
@@ -291,14 +291,9 @@ _zsh_autosuggest_suggestion() {
setopt localoptions extendedglob setopt localoptions extendedglob
# Escape the prefix (requires EXTENDED_GLOB) # Escape the prefix (requires EXTENDED_GLOB)
local prefix=${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH} local prefix="${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}"
# Get all history items (reversed) that match pattern $prefix* fc -ln -m "$prefix*" 2>/dev/null | tail -1
local history_matches
history_matches=(${history[(R)$prefix*]})
# Echo the first item that matches
echo ${history_matches[1]}
} }
#--------------------------------------------------------------------# #--------------------------------------------------------------------#