首页 > 解决方案 > 如何使 zsh 完成显示所有参数?

问题描述

我的系统:macOS Catalina 10.15.6

zsh 版本:zsh 5.7.1 (x86_64-apple-darwin19.0)

git版本:2.26.2


zsh 完成代码

#compdef logs
args="`git branch -a | grep ${!#} | sed 's/\*//g' | sed 's/remotes\///g'`"
args="$args `git tag -l | grep "${!#}"`"
_arguments "*: :($args)"

当我logs在 git 路径中使用时

> logs <tab>
zsh: do you wish to see all 150 possibilities (50 lines)?

当我在同一路径中使用git branch -a | wc -lgit tag -l | wc -l

> git branch -a | wc -l
109
> git tag -l | wc -l
288

我有像release/v3.5.4-abc和这样的分支名称release/v3.5.3-xxx

当我使用logs 3.5.4<tab>.

release/v3.5.3-xxx但是当我使用它时它会给我logs 3.5.3<tab>

似乎有些候选人被抛弃了。

我怎样才能获得所有候选人?

标签: gitautocompletezshoh-my-zsh

解决方案


推荐阅读