简体   繁体   English

zsh git 命令自动完成和文件名自动完成一起?

[英]zsh git COMMAND autocomplete and filename autocomplete together?

NOTE: I know there are many questions about autocomplete, but I am specifically asking a question about autocompletion of the git command, not regular autocomplete for listing files in a directory.注意:我知道有很多关于自动完成的问题,但我特别问了一个关于 git 命令的自动完成的问题,而不是用于列出目录中文件的常规自动完成。

I am running Mac Catalina and have finally decided to hop on the zsh train.我正在运行 Mac Catalina 并最终决定跳上 zsh 火车。 I wanted to get git command auto complete working (ie I type git a and hit tab and options for add , apply , etc come up).我想让 git 命令自动完成工作(即我输入git a并点击选项卡和addapply等选项)。

I performed the recommended addition of autoload -Uz compinit && compinit to my ~/.zshrc file and voilà I had git command completion.我执行了推荐的将autoload -Uz compinit && compinit到我的 ~/ autoload -Uz compinit && compinit文件,瞧我有 git 命令完成。 Yay!好极了!

However, once I get to the git add point and try to tab complete to get the names of the files in the directory, I get nothing.但是,一旦我到达git add点并尝试使用 Tab Complete 来获取目录中文件的名称,我什么也得不到。 Regular tab completion for ls , cp , etc work fine, but not for git after the addition of a command. lscp等的常规选项卡完成工作正常,但在添加命令后不适用于git

Is there a way to fix this problem so that I can get both the command autocomplete AND the file autocomplete working?有没有办法解决这个问题,以便我可以让命令自动完成和文件自动完成工作?

It should be working.它应该工作。 Have you definitely got modified or untracked files in your current directory?您确定在当前目录中有修改或未跟踪的文件吗? I'd recommend the following configuration style so that it will tell you:我建议使用以下配置样式,以便它会告诉您:

zstyle ':completion:*:warnings' format 'No matches for: %d'

Does completion after something else like git mv work?git mv类的其他事情之后完成是否有效?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM