简体   繁体   English

Zsh中git的大小写不敏感完成

[英]Case insensitive completion for git in zsh

I have zsh setup to do case insensitive completion but somehow file matching for git completion remains case sensitive: 我有zsh设置来执行不区分大小写的完成,但是以某种方式匹配git完成的文件仍然区分大小写:

% zsh -f
% autoload -U compinit && compinit
% zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
% setopt nocasematch
% touch Foo
% ls fo[TAB]
% ls Foo # completes to foo
Foo
% git add fo[TAB] # does not complete

Any ideas? 有任何想法吗?

Try this: 尝试这个:

% zstyle ':completion:*:*:git:files' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'

I don't know why this is necessary, probably something in the implementation of the _git completion code. 我不知道为什么这是必需的,可能是_git完成代码的实现中的某些内容。 That thing is over 6000 lines long. 那东西超过6000行。

Solution: take _git from Zsh's 'master' branch. 解决方案:从Zsh的“ master”分支获取_git Latest version of Zsh today is 5.0.5, zsh's master I took _git from is at commit c8e5be9d0fbbc6fb1cf06175b7c3d4757f6d973c . 今天的Zsh的最新版本是5.0.5,我从_git那里获得的zsh的主_git是在commit c8e5be9d0fbbc6fb1cf06175b7c3d4757f6d973c提交的。

Repository is at git://git.code.sf.net/p/zsh/code . 仓库位于git://git.code.sf.net/p/zsh/code

With these unreleased changes completion for git-add is case insensitive. 使用这些未发布的更改, git-add完成不区分大小写。

At Zsh-5.0.5 stuff like git-diff is case insensitive but git-add is not. 在Zsh-5.0.5,像git-diff类的东西不区分大小写,而git-add则不区分大小写。

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

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