浏览代码

command-not-found: speed up call to Homebrew command-not-found (#7740)

By sourcing brew files directly we can achieve a very high speed up.
This will not work if the user installed homebrew in a different
location than by default.
Hielke Walinga 4 年之前
父节点
当前提交
ed94e06dda
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      plugins/command-not-found/command-not-found.plugin.zsh

+ 2 - 4
plugins/command-not-found/command-not-found.plugin.zsh

@@ -26,10 +26,8 @@ fi
 
 # OSX command-not-found support
 # https://github.com/Homebrew/homebrew-command-not-found
-if type brew &> /dev/null; then
-  if brew command command-not-found-init > /dev/null 2>&1; then
-    eval "$(brew command-not-found-init)";
-  fi
+if [[ -s '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' ]]; then
+    source '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh'
 fi
 
 # NixOS command-not-found support