Skip to content

Commit d169c95

Browse files
authored
fix: Move 'emulate' command outside interactive check (#3736)
1 parent 90d7e38 commit d169c95

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

shell/completion.zsh

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
# - $FZF_COMPLETION_TRIGGER (default: '**')
1010
# - $FZF_COMPLETION_OPTS (default: empty)
1111

12-
if [[ -o interactive ]]; then
13-
1412

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

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

346347
zle -N fzf-completion
347348
bindkey '^I' fzf-completion
349+
fi
348350

349351
} always {
350352
# Restore the original options.
351353
eval $__fzf_completion_options
352354
'unset' '__fzf_completion_options'
353355
}
354-
355-
fi

shell/key-bindings.zsh

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
# - $FZF_ALT_C_COMMAND
1212
# - $FZF_ALT_C_OPTS
1313

14-
if [[ -o interactive ]]; then
15-
1614

1715
# Key bindings
1816
# ------------
@@ -38,6 +36,7 @@ fi
3836
'builtin' 'emulate' 'zsh' && 'builtin' 'setopt' 'no_aliases'
3937

4038
{
39+
if [[ -o interactive ]]; then
4140

4241
# CTRL-T - Paste the selected file path(s) into the command line
4342
__fsel() {
@@ -114,10 +113,9 @@ zle -N fzf-history-widget
114113
bindkey -M emacs '^R' fzf-history-widget
115114
bindkey -M vicmd '^R' fzf-history-widget
116115
bindkey -M viins '^R' fzf-history-widget
116+
fi
117117

118118
} always {
119119
eval $__fzf_key_bindings_options
120120
'unset' '__fzf_key_bindings_options'
121121
}
122-
123-
fi

0 commit comments

Comments
 (0)