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

[shell] Skip loading completion code on non-interactive shell

This change is not required if you use the install script to generate
~/.fzf.bash or ~/.fzf.zsh which already has the proper guard statement.

Close #1474
This commit is contained in:
Junegunn Choi 2019-02-28 16:13:59 +09:00
parent 8dc1377efb
commit 8cf45a5197
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
2 changed files with 8 additions and 0 deletions

View File

@ -9,6 +9,8 @@
# - $FZF_COMPLETION_TRIGGER (default: '**')
# - $FZF_COMPLETION_OPTS (default: empty)
if [[ $- =~ i ]]; then
# To use custom commands instead of find, override _fzf_compgen_{path,dir}
if ! declare -f _fzf_compgen_path > /dev/null; then
_fzf_compgen_path() {
@ -330,3 +332,5 @@ complete -F _fzf_complete_export -o default -o bashdefault export
complete -F _fzf_complete_unalias -o default -o bashdefault unalias
unset cmd d_cmds a_cmds x_cmds
fi

View File

@ -9,6 +9,8 @@
# - $FZF_COMPLETION_TRIGGER (default: '**')
# - $FZF_COMPLETION_OPTS (default: empty)
if [[ $- =~ i ]]; then
# To use custom commands instead of find, override _fzf_compgen_{path,dir}
if ! declare -f _fzf_compgen_path > /dev/null; then
_fzf_compgen_path() {
@ -192,3 +194,5 @@ fzf-completion() {
zle -N fzf-completion
bindkey '^I' fzf-completion
fi