summaryrefslogtreecommitdiff
path: root/plugins/flutter/flutter.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/flutter/flutter.plugin.zsh')
-rw-r--r--plugins/flutter/flutter.plugin.zsh15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/flutter/flutter.plugin.zsh b/plugins/flutter/flutter.plugin.zsh
index 80b74f64a..44d196cd4 100644
--- a/plugins/flutter/flutter.plugin.zsh
+++ b/plugins/flutter/flutter.plugin.zsh
@@ -12,3 +12,18 @@ alias flrd="flutter run --debug"
alias flrp="flutter run --profile"
alias flrr="flutter run --release"
alias flupgrd="flutter upgrade"
+
+# COMPLETION FUNCTION
+if (( ! $+commands[flutter] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `flutter`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_flutter" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _flutter
+ _comps[flutter]=_flutter
+fi
+
+flutter zsh-completion >| "$ZSH_CACHE_DIR/completions/_flutter" &| \ No newline at end of file