Skip to content

Commit

Permalink
fix: Move 'emulate' command outside interactive check (#3736)
Browse files Browse the repository at this point in the history
  • Loading branch information
LangLangBart committed Apr 17, 2024
1 parent 90d7e38 commit d169c95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions shell/completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
# - $FZF_COMPLETION_TRIGGER (default: '**')
# - $FZF_COMPLETION_OPTS (default: empty)

if [[ -o interactive ]]; then


# Both branches of the following `if` do the same thing -- define
# __fzf_completion_options such that `eval $__fzf_completion_options` sets
Expand Down Expand Up @@ -75,6 +73,9 @@ fi
# This brace is the start of try-always block. The `always` part is like
# `finally` in lesser languages. We use it to *always* restore user options.
{
# The 'emulate' command should not be placed inside the interactive if check;
# placing it there fails to disable alias expansion. See #3731.
if [[ -o interactive ]]; then

# To use custom commands instead of find, override _fzf_compgen_{path,dir}
#
Expand Down Expand Up @@ -345,11 +346,10 @@ fzf-completion() {

zle -N fzf-completion
bindkey '^I' fzf-completion
fi

} always {
# Restore the original options.
eval $__fzf_completion_options
'unset' '__fzf_completion_options'
}

fi
6 changes: 2 additions & 4 deletions shell/key-bindings.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
# - $FZF_ALT_C_COMMAND
# - $FZF_ALT_C_OPTS

if [[ -o interactive ]]; then


# Key bindings
# ------------
Expand All @@ -38,6 +36,7 @@ fi
'builtin' 'emulate' 'zsh' && 'builtin' 'setopt' 'no_aliases'

{
if [[ -o interactive ]]; then

# CTRL-T - Paste the selected file path(s) into the command line
__fsel() {
Expand Down Expand Up @@ -114,10 +113,9 @@ zle -N fzf-history-widget
bindkey -M emacs '^R' fzf-history-widget
bindkey -M vicmd '^R' fzf-history-widget
bindkey -M viins '^R' fzf-history-widget
fi

} always {
eval $__fzf_key_bindings_options
'unset' '__fzf_key_bindings_options'
}

fi

0 comments on commit d169c95

Please sign in to comment.