zsh git 自动完成:__git_find_on_cmdline 错误 [英] zsh git autocomplete: __git_find_on_cmdline error

查看:36
本文介绍了zsh git 自动完成:__git_find_on_cmdline 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让 git autocomplete 与 zsh 一起工作,但遇到了一个奇怪的错误(即使自动完成似乎成功完成):

I am trying to get git autocomplete working with zsh and am running into a weird error (even though the autocomplete appears to complete successfully):

安装:

mkdir -p ~/.zsh
cd ~/.zsh
curl -o git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
curl -o _git https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh

添加到~/.zshrc:

zstyle ':completion:*:*:git:*' script ~/.zsh/git-completion.bash
fpath=(~/.zsh $fpath)

autoload -Uz compinit && compinit

我打开一个新的 shell 并运行 git checkout + ty";+ tab 并且我希望它使用typescript"自动完成没有错误:

I open a new shell and run git checkout + "ty" + tab and I expect it to autocomplete with "typescript" with no errors:

raine[npm-check-updates]% gc ty__git_find_on_cmdline:[:7: unknown condition: -lt                                    ✓
__git_find_on_cmdline:[:7: unknown condition: -lt
__git_find_on_cmdline:[:7: unknown condition: -lt
pescript

它会自动完成打字稿"但中间有一个错误,就在我点击标签的地方.这是什么原因造成的,我该如何让它消失?

It does autocomplete to "typescript" but with an error in between, right where I hit tab. What is causing this and how do I make it go away?

推荐答案

Zsh 具有开箱即用的出色 Git 补全功能.把你发布的所有东西都扔掉,除了这个:

Zsh comes with excellent Git completion out of the box. Just throw everything you posted away, except this:

autoload -Uz compinit && compinit

然后它就可以正常工作了.

Then it'll work just fine.

这篇关于zsh git 自动完成:__git_find_on_cmdline 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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