summaryrefslogtreecommitdiff
path: root/shell/completion.zsh
diff options
context:
space:
mode:
authorSebastian Reuße <seb@wirrsal.net>2016-07-04 12:13:02 +0200
committerSebastian Reuße <seb@wirrsal.net>2016-07-05 08:57:11 +0200
commitfed5e5d5afbc0a553a0116f77342f047df03ad7d (patch)
tree35c52f3f60b862aed1913d473ed9e93dd1738be5 /shell/completion.zsh
parentb864885753f67b3985406f7b901a9563100f768a (diff)
downloadfzf-fed5e5d5afbc0a553a0116f77342f047df03ad7d.tar.gz
[zsh] Re-initialize zle when widgets finish
zle automatically calls zle-line-init when it starts to read a new line. Many Zsh setups use this hook to set the terminal into application mode, since this will then allow defining keybinds based on the $terminfo variable (the escape codes in said variable are only valid in application mode). However, fzf resets the terminal into raw mode, rendering $terminfo values invalid once the widget has finished. Accordingly, keyboard bindings defined via $terminfo won’t work anymore. This fixes the issue by calling zle-line-init when widgets finish. Care is taken to not call this widget when it is undefined. Fixes #279
Diffstat (limited to 'shell/completion.zsh')
-rw-r--r--shell/completion.zsh3
1 files changed, 3 insertions, 0 deletions
diff --git a/shell/completion.zsh b/shell/completion.zsh
index 60ef3d20..003f5c19 100644
--- a/shell/completion.zsh
+++ b/shell/completion.zsh
@@ -58,6 +58,7 @@ __fzf_generic_path_completion() {
LBUFFER="$lbuf$matches$tail"
fi
zle redisplay
+ typeset -f zle-line-init >/dev/null && zle zle-line-init
break
fi
dir=$(dirname "$dir")
@@ -97,6 +98,7 @@ _fzf_complete() {
LBUFFER="$lbuf$matches"
fi
zle redisplay
+ typeset -f zle-line-init >/dev/null && zle zle-line-init
rm -f "$fifo"
}
@@ -161,6 +163,7 @@ fzf-completion() {
LBUFFER="$LBUFFER$matches"
fi
zle redisplay
+ typeset -f zle-line-init >/dev/null && zle zle-line-init
# Trigger sequence given
elif [ ${#tokens} -gt 1 -a "$tail" = "$trigger" ]; then
d_cmds=(${=FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir})