zile: Yet another editor configuration.
[profile] / bash_completion
index 1634e81..428ed68 100644 (file)
@@ -2,3 +2,26 @@
 
 [ "$(type -t _command)" = "function" ] &&
 complete -F _command r rootly
+
+declare -a _hyperspec_completions
+_hyperspec_made_completions=no
+_complete-hyperspec () {
+  case "$_hyperspec_made_completions" in
+    no)
+      _hyperspec_completions=($(hyperspec -l))
+      _hyperspec_made_completions=yes
+      ;;
+  esac
+  COMPREPLY=()
+  local -i i=0
+  local prefix=${COMP_WORDS[$COMP_CWORD]}
+  for sym in "${_hyperspec_completions[@]}"; do
+    case "$sym" in
+      $prefix*)
+        COMPREPLY[$i]=$sym
+       i+=1
+       ;;
+    esac
+  done
+}
+complete -F _complete-hyperspec hyperspec