diff options
| author | zhaoyunfeng <yunfeng.zhao@duobei.com> | 2018-06-28 13:58:09 +0800 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2019-11-03 00:33:30 +0900 |
| commit | b911af200c4ed4085a76d3e0a12458ccba2d3b3f (patch) | |
| tree | 3a3f7ef650f3d770ca9bea49c55ee3e9693d078c /shell | |
| parent | 68683c444f2bb6f869c8ac22b5d12fe014345885 (diff) | |
| download | fzf-b911af200c4ed4085a76d3e0a12458ccba2d3b3f.tar.gz | |
[zsh-completion] Fix prefix extraction when triggers start with ';'
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/completion.zsh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/shell/completion.zsh b/shell/completion.zsh index ed1f2796..509f5812 100644 --- a/shell/completion.zsh +++ b/shell/completion.zsh @@ -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 |
