rbw.plugin.zsh 630 B

12345678910111213141516171819
  1. if (( ! $+commands[rbw] )); then
  2. return
  3. fi
  4. # TODO: 2021-12-28: remove this bit of code as it exists in oh-my-zsh.sh
  5. # Add completions folder in $ZSH_CACHE_DIR
  6. command mkdir -p "$ZSH_CACHE_DIR/completions"
  7. (( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
  8. # If the completion file doesn't exist yet, we need to autoload it and
  9. # bind it to `rbw`. Otherwise, compinit will have already done that.
  10. if [[ ! -f "$ZSH_CACHE_DIR/completions/_rbw" ]]; then
  11. typeset -g -A _comps
  12. autoload -Uz _rbw
  13. _comps[rbw]=_rbw
  14. fi
  15. rbw gen-completions zsh >| "$ZSH_CACHE_DIR/completions/_rbw" &|