zsh-users
 help / color / mirror / code / Atom feed
* Case-aware completion that respects the user-entered case
@ 2015-08-18 14:38 Joshua Buxton
  2015-08-18 17:11 ` Jun T.
  0 siblings, 1 reply; 2+ messages in thread
From: Joshua Buxton @ 2015-08-18 14:38 UTC (permalink / raw)
  To: zsh-users

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Case-aware completion that respects the user-entered case
  2015-08-18 14:38 Case-aware completion that respects the user-entered case Joshua Buxton
@ 2015-08-18 17:11 ` Jun T.
  0 siblings, 0 replies; 2+ messages in thread
From: Jun T. @ 2015-08-18 17:11 UTC (permalink / raw)
  To: zsh-users


2015/08/18 23:38, oshua Buxton <josh@joshuabuxton.ca> wrote:
> Unfortunately, if "cd Te<tab>" is used, "cd Temp1/" is filled in and
> nothing else will be suggested.

You may try

zstyle ':completion:*:complete:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

Is this what you want?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-18 18:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-18 14:38 Case-aware completion that respects the user-entered case Joshua Buxton
2015-08-18 17:11 ` Jun T.

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).