2
0
mirror of https://github.com/junegunn/fzf synced 2024-10-30 09:20:14 +00:00

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

This commit is contained in:
zhaoyunfeng 2018-06-28 13:58:09 +08:00 committed by Junegunn Choi
parent 68683c444f
commit b911af200c
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -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