mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-22 21:05:09 +00:00
[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
This commit is contained in:
parent
b864885753
commit
fed5e5d5af
@ -58,6 +58,7 @@ __fzf_generic_path_completion() {
|
|||||||
LBUFFER="$lbuf$matches$tail"
|
LBUFFER="$lbuf$matches$tail"
|
||||||
fi
|
fi
|
||||||
zle redisplay
|
zle redisplay
|
||||||
|
typeset -f zle-line-init >/dev/null && zle zle-line-init
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
dir=$(dirname "$dir")
|
dir=$(dirname "$dir")
|
||||||
@ -97,6 +98,7 @@ _fzf_complete() {
|
|||||||
LBUFFER="$lbuf$matches"
|
LBUFFER="$lbuf$matches"
|
||||||
fi
|
fi
|
||||||
zle redisplay
|
zle redisplay
|
||||||
|
typeset -f zle-line-init >/dev/null && zle zle-line-init
|
||||||
rm -f "$fifo"
|
rm -f "$fifo"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +163,7 @@ fzf-completion() {
|
|||||||
LBUFFER="$LBUFFER$matches"
|
LBUFFER="$LBUFFER$matches"
|
||||||
fi
|
fi
|
||||||
zle redisplay
|
zle redisplay
|
||||||
|
typeset -f zle-line-init >/dev/null && zle zle-line-init
|
||||||
# Trigger sequence given
|
# Trigger sequence given
|
||||||
elif [ ${#tokens} -gt 1 -a "$tail" = "$trigger" ]; then
|
elif [ ${#tokens} -gt 1 -a "$tail" = "$trigger" ]; then
|
||||||
d_cmds=(${=FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir})
|
d_cmds=(${=FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir})
|
||||||
|
@ -25,6 +25,7 @@ fzf-file-widget() {
|
|||||||
LBUFFER="${LBUFFER}$(__fsel)"
|
LBUFFER="${LBUFFER}$(__fsel)"
|
||||||
local ret=$?
|
local ret=$?
|
||||||
zle redisplay
|
zle redisplay
|
||||||
|
typeset -f zle-line-init >/dev/null && zle zle-line-init
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
zle -N fzf-file-widget
|
zle -N fzf-file-widget
|
||||||
@ -38,6 +39,7 @@ fzf-cd-widget() {
|
|||||||
cd "${$(eval "$cmd | $(__fzfcmd) +m $FZF_ALT_C_OPTS"):-.}"
|
cd "${$(eval "$cmd | $(__fzfcmd) +m $FZF_ALT_C_OPTS"):-.}"
|
||||||
local ret=$?
|
local ret=$?
|
||||||
zle reset-prompt
|
zle reset-prompt
|
||||||
|
typeset -f zle-line-init >/dev/null && zle zle-line-init
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
zle -N fzf-cd-widget
|
zle -N fzf-cd-widget
|
||||||
@ -56,6 +58,7 @@ fzf-history-widget() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
zle redisplay
|
zle redisplay
|
||||||
|
typeset -f zle-line-init >/dev/null && zle zle-line-init
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
zle -N fzf-history-widget
|
zle -N fzf-history-widget
|
||||||
|
Loading…
Reference in New Issue
Block a user