IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Mac Brew Tab 命令自动补全

    张三的网络日志发表于 2022-07-26 22:17:56
    love 0

    mac arm版 2021版的brew 一键安装后 命令 按tab 不能补全,今天有点闲,就搜了一下,给解决了

    用的 Oh My Zsh,官方文档里写的很详细,不过是英文的,这里给翻译记录下

    1、在 ~/.zshrc 里添加下面code

    if type brew &>/dev/null
    then
      FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
    
      autoload -Uz compinit
      compinit
    fi
    

    2、在 ~/.zprofile 里添加下面code

    FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
    

    3、强制重建zcompdump

    rm -f ~/.zcompdump; compinit
    

    4、如果出现 zsh compinit: insecure directory 警告

    chmod -R go-w "$(brew --prefix)/share"
    

    参考:

    Homebrew Shell Completion — Homebrew Documentation



沪ICP备19023445号-2号
友情链接