如何使用zsh compinit启用git文件制表符完成? [英] How to enable git file tab completion with zsh compinit?

查看:65
本文介绍了如何使用zsh compinit启用git文件制表符完成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在zsh选项卡完成方面遇到问题:运行后:

I have a problem with the zsh tab completion: After running:

autoload -U compinit
compinit

文件的Git选项卡完成不再起作用.例如,如果我键入git add my_f来完成my_file,则什么也不会发生.zsh git完成似乎仅适用于git分支和标签.

Git tab completion for files does not work any more. For example if I type git add my_f to complete my_file, nothing happens. The zsh git completion only seems to work for git branches and tags.

没有compinit的东西,git文件的完成工作,但我当然会错过所有花哨的分支完成的东西.

Without the compinit stuff, git file completion works, but of course I'm missing out all the fancy branch completion stuff.

所以...有没有办法在zsh中同时完成git文件完成和git分支完成?这确实对我有很大帮助.

So... Is there a way to make git file completion AND git branch completion possible at the same time in zsh? This would really help me a lot.

推荐答案

(我在这里添加答案主要是为了将其从未答复列表中删除.)

(I'm adding an answer here mostly to get it off the unanswered list.)

正如您从注释中看到的那样,它确实有效.我相信整个zsh情况最近也得到了显着改善:

As you can see from the comments, it does work. I believe the whole zsh situation has recently improved significantly, too:

提交06f44c3cc5ca5eca638f300a518c65aa98d26d6d

commit 06f44c3cc5ca5eca638f300a518c65aa98d26d6d

日期:2010年9月6日星期一08:33:19 -0400

Date: Mon Sep 6 08:33:19 2010 -0400

完成:与zsh兼容

修改git-completion.bash,以便在使用bashcompinit时也可与zsh一起使用....

Modify git-completion.bash so that it also works with zsh when using bashcompinit. ...

因此,如果您在整个谷歌搜索中碰巧遇到问题,而您的完成工作无法正常进行,请尝试升级您的

So, if you happen across this googling, and your completion isn't working, try upgrading your git-completion.bash (link points to the blob from git.git HEAD). Current git version is 1.7.3.2; it should make it into the next one.

这篇关于如何使用zsh compinit启用git文件制表符完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆