[英]Customizing completion in Prezto ZSH for git function
I recently switched from bash to zsh and am using Prezto for basic setup.我最近从 bash 切换到 zsh 并使用 Prezto 进行基本设置。 For a long time I've used this function:很长一段时间我一直在使用这个 function:
function g() {
if [[ $# > 0 ]]; then
git $@
else
git status
fi
}
This allows me to use g
for git status
or g <command>
for any other git action.这允许我将g
用于git status
或g <command>
用于任何其他 git 操作。
The Prezto git module had an alias that was overriding my function alias g='git'
Prezto git 模块的别名覆盖了我的 function alias g='git'
So I commented this out and my function worked as expected.所以我评论了这一点,我的 function 按预期工作。 However the problem comes in when I need tab completion.但是,当我需要制表符完成时,问题就来了。
ex:前任:
I have thus far been unable to marry using my function with the git completion modules so that I can do things like g checkout aw-<tab>
and have it show me the branch options.到目前为止,我还无法将 function 与 git 完成模块结合使用,以便我可以执行g checkout aw-<tab>
之类的操作并让它显示分支选项。
I had this working fine in bash and would love to be able to have similar functionality in zsh.我在 bash 中可以正常工作,并且希望能够在 zsh 中具有类似的功能。
Thank you in advance!先感谢您!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.