snooprat
V2EX  ›  macOS

Arm 版 brew 无法按 tab 补全命令

  •  
  •   snooprat · Dec 26, 2020 · 4150 views
    This topic created in 1989 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
        1
    wengych  
       Dec 26, 2020
    ??

    brew install zsh-completion

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

    setopt completealiases
    snooprat
        7
    snooprat  
    OP
       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.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2909 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 56ms · UTC 06:23 · PVG 14:23 · LAX 23:23 · JFK 02:23
    ♥ Do have faith in what you're doing.