zsh apt列表选项完成


10

我已经习惯了使用在bash tab完成获得apt list --upgradable通过打字apt ltab--utab,但我不能做的zsh同样的事情:--u没有扩展到--upgradable当我按下tab

我用谷歌搜索了一些建议安装zsh-completions并将其添加setopt completealiases到的解决方案./zshrc,但是这些都没有帮助。

有什么方法可以使其像在bash中一样工作吗?

Answers:


3

请遵循此处的步骤以获取其他功能:https : //github.com/abhigenie92/zsh_to_fish

  1. 安装oh-my-zsh

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

  1. 克隆必要的插件。

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

  1. 将插件添加~/.zshrc

plugins = ( [plugins...] zsh-autosuggestions zsh-history-substring-search zsh-syntax-highlighting) 注意:确保zsh-syntax-highlighting是以上列表中的最后一个。

  1. 解决背景主题问题(不一定取决于主题。)将以下行添加到中~/.zshrc

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=white'

  1. 重新启动zsh

source ~/.zshrc

如果您喜欢答案,请考虑为github存储库加注星标。


谢谢您的回答。但是,它只能中途解决问题:我为apt list而不是为完成--upgradable。当我开始输入时--u,它的确显示了建议,但按tab不会自动完成建议。
亚历山大·雷沃

这个问题有更新吗?
Jamie-505
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.