Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Case-aware completion that respects the user-entered case
- X-seq: zsh-users 20428
- From: Joshua Buxton <josh@xxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Case-aware completion that respects the user-entered case
- Date: Tue, 18 Aug 2015 11:38:13 -0300
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
As per the discussion here: http://www.zsh.org/mla/users/2003/msg00611.html
I'm trying to do the same thing: have zsh respect the case I used, but
still offer case-insensitive matches when tab is pressed.
Test suite:
./Temp1
./temp2
./temp3
./tEMP4
What I'm looking for:
"cd te<tab>" fills in "cd temp" then stops. pressing <tab> again brings up
a menu that suggests the case-sensitive option first: "temp2/ temp3/
Temp1/ tEMP4/"
The suggestion in the thread almost fits:
_cscomplete() {
_complete
return 1
}
zstyle ':completion:*:cscomplete:*' group-name case-sensitive
zstyle ':completion:*:complete:*' group-name case-insensitive
zstyle ':completion:*' group-order case-sensitive case-insensitive
zstyle ':completion:*::::' completer _cscomplete _complete
zstyle ':completion:*:cscomplete:*:*' matcher-list ''
zstyle ':completion:*:complete:*' matcher-list 'm:{a-z}={A-Z}'
"cd te<tab>" fills in "cd temp" then stops. pressing <tab> again brings up
a menu that suggests the case-sensitive option first:
"temp2/ temp3/
Temp1/ temp2/ temp3/ tEMP4/"
Unfortunately, if "cd Te<tab>" is used, "cd Temp1/" is filled in and
nothing else will be suggested.
Is there a way to modify the code above so that the same second menu
("Temp1/ temp2/ temp3/ tEMP4/") is shown, even when a single match is
found?
*As you may be able to tell, I don't understand how zstyle works. I'm just
trying to scratch the one itch in an otherwise perfect solution.*
Thanks in advance
--
I am also a systems administrator by trade, a teacher by nature, and a
mindful cook by passion.
Sent from my iPhone
Messages sorted by:
Reverse Date,
Date,
Thread,
Author