Compare commits

..
11 Commits
6 changed files with 22 additions and 5 deletions
+1
View File
@@ -4,6 +4,7 @@ _[Fish](http://fishshell.com/)-like fast/unobtrusive autosuggestions for zsh._
It suggests commands as you type, based on command history.
<a href="https://asciinema.org/a/36578" target="_blank"><img src="https://asciinema.org/a/36578.png" width="520"/></a>
## Installation
+1 -1
View File
@@ -1 +1 @@
v0.2.9
v0.2.13
+1 -1
View File
@@ -102,7 +102,7 @@ testWidgetFunctionModify() {
POSTDISPLAY=""
stub_and_eval \
_zsh_autosuggest_invoke_original_widget \
_zsh_autosuggest_invoke_original_widget \
'BUFFER+="e"'
stub_and_echo \
+3
View File
@@ -66,6 +66,9 @@ _zsh_autosuggest_bind_widgets() {
# Given the name of an original widget and args, invoke it, if it exists
_zsh_autosuggest_invoke_original_widget() {
# Do nothing unless called with at least one arg
[ $# -gt 0 ] || return
local original_widget_name=$1
shift
+6 -1
View File
@@ -10,5 +10,10 @@ _zsh_autosuggest_suggestion() {
# Escape the prefix (requires EXTENDED_GLOB)
local prefix="${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}"
fc -ln -m "$prefix*" 2>/dev/null | tail -1
# Get all history items (reversed) that match pattern $prefix*
local history_matches
history_matches=(${(j:\0:s:\0:)history[(R)$prefix*]})
# Echo the first item that matches
echo "$history_matches[1]"
}
+10 -2
View File
@@ -1,6 +1,6 @@
# Fish-like fast/unobtrusive autosuggestions for zsh.
# https://github.com/tarruda/zsh-autosuggestions
# v0.2.9
# v0.2.13
# Copyright (c) 2013 Thiago de Arruda
# Copyright (c) 2016 Eric Freese
#
@@ -168,6 +168,9 @@ _zsh_autosuggest_bind_widgets() {
# Given the name of an original widget and args, invoke it, if it exists
_zsh_autosuggest_invoke_original_widget() {
# Do nothing unless called with at least one arg
[ $# -gt 0 ] || return
local original_widget_name=$1
shift
@@ -293,7 +296,12 @@ _zsh_autosuggest_suggestion() {
# Escape the prefix (requires EXTENDED_GLOB)
local prefix="${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}"
fc -ln -m "$prefix*" 2>/dev/null | tail -1
# Get all history items (reversed) that match pattern $prefix*
local history_matches
history_matches=(${(j:\0:s:\0:)history[(R)$prefix*]})
# Echo the first item that matches
echo "$history_matches[1]"
}
#--------------------------------------------------------------------#