From: Joshua Buxton <josh@joshuabuxton.ca>
To: zsh-users@zsh.org
Subject: Case-aware completion that respects the user-entered case
Date: Tue, 18 Aug 2015 11:38:13 -0300 [thread overview]
Message-ID: <CAAOEOmUPRa_hAqHUZHchEQEgDTWDjmLtE1A6iUEFurffbQb78g@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1610 bytes --]
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
next reply other threads:[~2015-08-18 14:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-18 14:38 Joshua Buxton [this message]
2015-08-18 17:11 ` Jun T.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAOEOmUPRa_hAqHUZHchEQEgDTWDjmLtE1A6iUEFurffbQb78g@mail.gmail.com \
--to=josh@joshuabuxton.ca \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).