Merge pull request #13 from kassadin/fix-prompt

fix prompt
This commit is contained in:
Josh Skidmore
2021-09-10 06:50:28 -04:00
committed by GitHub

View File

@@ -4,10 +4,15 @@
fzf_history_search() { fzf_history_search() {
setopt extendedglob setopt extendedglob
candidates=(${(f)"$(fc -li -1 0 | fzf +s +m -x -e -q "$BUFFER")"}) candidates=(${(f)"$(fc -li -1 0 | fzf +s +m -x -e -q "$BUFFER")"})
local ret=$?
if [ -n "$candidates" ]; then
BUFFER="${candidates[@]/(#m)*/${${(As: :)MATCH}[4,-1]}}" BUFFER="${candidates[@]/(#m)*/${${(As: :)MATCH}[4,-1]}}"
BUFFER="${BUFFER[@]/(#b)(?)\\n/$match[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 autoload fzf_history_search