安装后cheat
(命令行中的命令备忘单),我尝试使用提供的 zsh 脚本启用自动完成功能。但是,我似乎没有找到脚本的正确位置。
至今
- 我拿
cheat.zsh
; - 将其复制到
~/.oh-my-zsh/custom/plugins/cheat/_cheat.zsh
; - 添加作弊添加到我的
plugins
数组中~/.zshrc
; - 重新加载我的外壳。
键入时不会自动完成cheat d<TAB>
。
问题
那么在Linux上将zsh自动补全脚本放在哪里呢?
安装后cheat
(命令行中的命令备忘单),我尝试使用提供的 zsh 脚本启用自动完成功能。但是,我似乎没有找到脚本的正确位置。
cheat.zsh
;~/.oh-my-zsh/custom/plugins/cheat/_cheat.zsh
;plugins
数组中~/.zshrc
;键入时不会自动完成cheat d<TAB>
。
那么在Linux上将zsh自动补全脚本放在哪里呢?
I got this to work by adding cheat.zsh
to the ~/.oh-my-zsh/plugins
directory. Zsh checks to autoload functions on FPATH
, so try:
echo $FPATH
and then either add to FPATH
or move the file into a folder on the path.
This actually does a much better job of explaining it: https://unix.stackexchange.com/questions/33255/how-to-define-and-load-your-own-shell-function-in-zsh
让我试着在这里帮忙。
我正在尝试类似的东西,这就是我能够让它发挥作用的方式。以下解决方案已oh-my-zsh
在 debian 发行版 [ubuntu] 上验证
> 你的 zsh 没有给出正确的完成建议说 [conda] > 这是你输入 # conda 时得到的结果tab
找到完成脚本
一个很棒的位置是https://github.com/clarketm/zsh-completions/tree/master/src
将文件下载到完成文件夹[~/.oh-my-zsh/completions]
wget https://raw.githubusercontent.com/clarketm/zsh-completions/master/src/_conda ~/.oh-my-zsh/completions
确保完成文件夹列在 $fpath 下
print -l $fpath
如果它没有列出它应该正常添加 .oh-my-zsh.sh 如果没有在下面附加到 ~/.oh-my-zsh/oh-my-zsh.sh
# add a function path
fpath=($ZSH/functions $ZSH/completions $fpath)
源.zshrc
source ~/.zshrc
执行compinit
这将为函数构建~/.zcompdump
文件
compinit
由于冲突,建议可能不会显示尝试以下
rm -f ~/.zcompdump; compinit
# we are clearing the function dump stored by zsh, its safe zsh will rebuilt it.
试试源码.zshrc
source ~/.zshrc
尝试注销并登录
检查映射~/.zcompdump
vi ~/.zcompdump
搜索康达
[/conda]
你应该看到如下
'conda' '_conda'
希望有人会觉得它有用,如果是的话很乐意提供帮助