mirror of
https://github.com/joshskidmore/zsh-fzf-history-search.git
synced 2026-09-10 07:06:21 -04:00
commit
07c075c139
|
|
@ -4,10 +4,15 @@
|
|||
fzf_history_search() {
|
||||
setopt extendedglob
|
||||
candidates=(${(f)"$(fc -li -1 0 | fzf +s +m -x -e -q "$BUFFER")"})
|
||||
BUFFER="${candidates[@]/(#m)*/${${(As: :)MATCH}[4,-1]}}"
|
||||
BUFFER="${BUFFER[@]/(#b)(?)\\n/$match[1]
|
||||
local ret=$?
|
||||
if [ -n "$candidates" ]; then
|
||||
BUFFER="${candidates[@]/(#m)*/${${(As: :)MATCH}[4,-1]}}"
|
||||
BUFFER="${BUFFER[@]/(#b)(?)\\n/$match[1]
|
||||
}"
|
||||
zle end-of-buffer-or-history
|
||||
zle vi-fetch-history -n $BUFFER
|
||||
fi
|
||||
zle reset-prompt
|
||||
return $ret
|
||||
}
|
||||
|
||||
autoload fzf_history_search
|
||||
|
|
|
|||
Loading…
Reference in a new issue