代码之家  ›  专栏  ›  技术社区  ›  Édouard Lopez

在Linux上将zsh自动完成脚本放置在何处?

  •  17
  • Édouard Lopez  · 技术社区  · 11 年前

    安装后 cheat (command cheat sheets from the command line) ,我尝试使用 provided zsh script 。然而,我似乎找不到脚本的正确位置。

    目前为止

    • 我去拿 cheat.zsh ;
    • 将其复制到 ~/.oh-my-zsh/custom/plugins/cheat/_cheat.zsh ;
    • 添加 欺骗 plugins 我的阵列 ~/.zshrc ;
    • 重新加载我的外壳。

    键入时不会自动完成 cheat d<TAB> .

    问题

    那么在Linux上将zsh自动完成脚本放在哪里呢?

    2 回复  |  直到 11 年前
        1
  •  20
  •   Armali    4 年前

    我通过添加 cheat.zsh ~/.oh-my-zsh/plugins 目录Zsh检查自动加载功能 FPATH ,请尝试:

    echo $FPATH
    

    然后添加到 FPATH路径 或将文件移动到路径上的文件夹中。

    这实际上在解释它方面做得更好: https://unix.stackexchange.com/questions/33255/how-to-define-and-load-your-own-shell-function-in-zsh

        2
  •  11
  •   Community Mohan Dere    4 年前

    让我来帮忙。

    我也在尝试类似的方法,这就是我如何做到的。 以下解决方案已通过验证 oh-my-zsh 关于debian发行版

    问题

      > Your zsh isnt giving proper completion suggestions say [conda]
      > This is what you get when you type in # conda tab
    

    enter image description here

    解决方案

    1. 查找完成脚本

      一个很好的位置是 https://github.com/clarketm/zsh-completions/tree/master/src

    2. 将文件下载到completions文件夹 [~/.oh-my-zsh/completions]

      wget https://raw.githubusercontent.com/clarketm/zsh-completions/master/src/_conda ~/.oh-my-zsh/completions
      
    3. 确保completions文件夹列在$fpath下

      print -l $fpath
      
      1. 如果未列出 它应该正常添加.oh-my-zsh.sh 如果没有,请将以下内容附加到~/.oh my zsh/oh-my-zsh.sh

        # add a function path
        fpath=($ZSH/functions $ZSH/completions $fpath)
        
      2. 来源.zshrc

        source ~/.zshrc
        
    4. 处决 compinit 这将建立 ~/.zcompdump 函数的文件

      compinit
      

    enter image description here

    故障排除

    1. 由于冲突,建议可能无法显示,请尝试以下操作

      rm -f ~/.zcompdump; compinit
      # we are clearing the function dump stored by zsh, its safe zsh will rebuilt it.
      
    2. Try源 .zshrc

      源~/.zshrc
      
    3. 尝试注销并登录

    4. 在中检查映射 ~/.z压缩

      vi ~/.zcompdump
      

      搜索conda

      [/conda]

      你应该看到如下

      'conda' '_conda'

    希望有人会发现它有用,如果真的很乐意帮忙

    推荐文章