summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2020-04-13 00:30:43 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2020-04-13 00:30:43 +0900
commitdea206b023a695b75540f642a0b19a3ba1e38eec (patch)
tree247faa642c8b78b6b46e58ee62d6c84ed675f0e8 /shell
parent5deaf589281ff606874bc7db2fd01ed7cf1e7f45 (diff)
downloadfzf-dea206b023a695b75540f642a0b19a3ba1e38eec.tar.gz
[zsh-completion] Fix error with backslash-prefixed commands
Fix #1973 Fix #1974 Fix #1975
Diffstat (limited to 'shell')
-rw-r--r--shell/completion.zsh3
1 files changed, 2 insertions, 1 deletions
diff --git a/shell/completion.zsh b/shell/completion.zsh
index 7e9f83ad..3381f463 100644
--- a/shell/completion.zsh
+++ b/shell/completion.zsh
@@ -117,6 +117,7 @@ __fzf_extract_command() {
local token tokens
tokens=(${(z)1})
for token in $tokens; do
+ token=${(Q)token}
if [[ "$token" =~ [[:alnum:]] && ! "$token" =~ "=" ]]; then
echo "$token"
return
@@ -275,7 +276,7 @@ fzf-completion() {
tail=${LBUFFER:$(( ${#LBUFFER} - ${#trigger} ))}
# Kill completion (do not require trigger sequence)
- if [ $cmd = kill -a ${LBUFFER[-1]} = ' ' ]; then
+ if [ "$cmd" = kill -a ${LBUFFER[-1]} = ' ' ]; then
matches=$(command ps -ef | sed 1d | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-50%} --min-height 15 --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS --preview 'echo {}' --preview-window down:3:wrap" __fzf_comprun "$cmd" -m | awk '{print $2}' | tr '\n' ' ')
if [ -n "$matches" ]; then
LBUFFER="$LBUFFER$matches"