summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorLangLangBart <92653266+LangLangBart@users.noreply.github.com>2024-06-13 10:33:23 +0200
committerGitHub <noreply@github.com>2024-06-13 17:33:23 +0900
commit22adb6494f4957d0bcc29a821b738b4e5d5796a5 (patch)
tree85403f835d79df62c33607adcdf6e5285fa76b77 /shell
parente023736c30e789073211ec5b3d49af860c3c3562 (diff)
downloadfzf-22adb6494f4957d0bcc29a821b738b4e5d5796a5.tar.gz
chore(shell): Separate declaration and assignment for zsh legacy versions (#3856)
Diffstat (limited to 'shell')
-rw-r--r--shell/completion.zsh9
1 files changed, 6 insertions, 3 deletions
diff --git a/shell/completion.zsh b/shell/completion.zsh
index 3634a0b1..aa03468e 100644
--- a/shell/completion.zsh
+++ b/shell/completion.zsh
@@ -157,7 +157,9 @@ __fzf_generic_path_completion() {
[ -z "$dir" ] && dir='.'
[ "$dir" != "/" ] && dir="${dir/%\//}"
matches=$(
- export FZF_DEFAULT_OPTS=$(__fzf_defaults "--reverse --scheme=path" "${FZF_COMPLETION_OPTS-}")
+ # Declare and assign separately for older zsh versions.
+ export FZF_DEFAULT_OPTS
+ FZF_DEFAULT_OPTS=$(__fzf_defaults "--reverse --scheme=path" "${FZF_COMPLETION_OPTS-}")
unset FZF_DEFAULT_COMMAND FZF_DEFAULT_OPTS_FILE
if declare -f "$compgen" > /dev/null; then
eval "$compgen $(printf %q "$dir")" | __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover"
@@ -264,13 +266,14 @@ _fzf_complete_telnet() {
# The first and the only argument is the LBUFFER without the current word that contains the trigger.
# The current word without the trigger is in the $prefix variable passed from the caller.
_fzf_complete_ssh() {
- local tokens=(${(z)1})
+ local -a tokens
+ tokens=(${(z)1})
case ${tokens[-1]} in
-i|-F|-E)
_fzf_path_completion "$prefix" "$1"
;;
*)
- local user=
+ local user
[[ $prefix =~ @ ]] && user="${prefix%%@*}@"
_fzf_complete +m -- "$@" < <(__fzf_list_hosts | awk -v user="$user" '{print user $0}')
;;