snooprat
V2EX  ›  macOS

Arm 版 brew 无法按 tab 补全命令

  •  
  •   snooprat · Dec 26, 2020 · 4548 views
    This topic created in 2164 days ago, the information mentioned may be changed or developed.

    M1 装上了 Arm 版 brew,一切都很好,唯一有个问题是之前可以按 tab 补全命令的,现在不行了,qit adb 都是正常的,不知道谁有遇到的吗?要如何解决?

    Supplement 1  ·  Dec 26, 2020

    解决了 To make Homebrew’s completions available in zsh, you must get the Homebrew-managed zsh site-functions on your FPATH before initialising zsh’s completion facility. Add the following to your ~/.zshrc file:

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

    This must be done before compinit is called. Note that if you are using Oh My Zsh, it will call compinit for you, so this must be done before you call oh-my-zsh.sh.

    7 replies  •  2020-12-26 16:37:39 +08:00
    wengych
    wengych
    Dec 26, 2020
    1
    ??

    brew install zsh-completion

    ??
    jfdnet
    jfdnet
    Dec 26, 2020
    2
    补全功能并不是 brew 带来的
    snooprat
    snooprat
    OP
    Dec 26, 2020 via iPhone
    3
    @jfdnet 之前我在 zsh 加 brew 插件是可以的,现在加了也没用
    snooprat
    snooprat
    OP
    Dec 26, 2020 via iPhone
    4
    @wengych 我试试这个
    wengych
    wengych
    Dec 26, 2020 via iPhone
    5
    @snooprat 安装后记得设置 zshrc
    sinxccc
    sinxccc
    Dec 26, 2020
    6
    在你的 .zshrc 里加上

    setopt completealiases
    snooprat
    snooprat
    OP
    Dec 26, 2020
    7
    最后还是在官方文档找到了解决方案,印象里之前没有配置过就能用,现在需要配置一下才生效。

    To make Homebrew’s completions available in zsh, you must get the Homebrew-managed zsh site-functions on your FPATH before initialising zsh’s completion facility. Add the following to your ~/.zshrc file:

    if type brew &>/dev/null; then
    FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH

    autoload -Uz compinit
    compinit
    fi

    This must be done before compinit is called. Note that if you are using Oh My Zsh, it will call compinit for you, so this must be done before you call oh-my-zsh.sh.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1992 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 04:26 · PVG 12:26 · LAX 20:26 · JFK 23:26
    ♥ Do have faith in what you're doing.