[zsh-completion] Fix prefix extraction when triggers start with ';'

pull/1738/head
zhaoyunfeng 6 years ago committed by Junegunn Choi
parent 68683c444f
commit b911af200c
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

@ -158,6 +158,12 @@ fzf-completion() {
trigger=${FZF_COMPLETION_TRIGGER-'**'}
[ -z "$trigger" -a ${LBUFFER[-1]} = ' ' ] && tokens+=("")
# When the trigger starts with ';', it becomes a separate token
if [[ ${LBUFFER} = *"${tokens[-2]}${tokens[-1]}" ]]; then
tokens[-2]="${tokens[-2]}${tokens[-1]}"
tokens=(${tokens[0,-2]})
fi
tail=${LBUFFER:$(( ${#LBUFFER} - ${#trigger} ))}
# Kill completion (do not require trigger sequence)
if [ $cmd = kill -a ${LBUFFER[-1]} = ' ' ]; then

Loading…
Cancel
Save