如何在zsh中源zash完成脚本文件

时间:2020-02-23 14:39:03  来源:igfitidea点击:

zsh用户有时需要使用bash完成脚本。
这是由只为其工具编写Bash完成脚本的开发人员需要。
在光明的一面,ZSH有一个Bash完成脚本兼容模式,我们必须在加载中,在加载中,我们必须在.zshrc内加载bash完成脚本。

在源行之前将以下添加到~/.zshrc文件中。

autoload bashcompinit
bashcompinit

我们还可以在zshrc文件的顶部添加行,以确保在加载之前不源于Bash脚本。

这些是我的~/.zshrc中的行,以便启用Bash完成。

autoload bashcompinit
bashcompinit
source /etc/profile.d/cheat.bash

我测试并确认是工作。

$cheat <TAB>
zsh: do you wish to see all 1254 possibilities (1254 lines)?