zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh-users List <zsh-users@sunsite.dk>
Subject: Re: Case-insensitive completion
Date: Sun, 14 Sep 2003 18:58:17 +0000	[thread overview]
Message-ID: <1030914185817.ZM27558@candle.brasslantern.com> (raw)
In-Reply-To: <20030914103053.GA827@strindberg.student.uu.se>

On Sep 14, 12:30pm, Jesper Holmberg wrote:
}
} As I interpret the manual, the following lines:
} 
} zstyle ':completion:*' completer _expand _complete _complete:jhcase _ignored
} zstyle ':completion:*:jhcase:*' matcher-list 'm:{a-z}={A-Z}'
} 
} would achieve what I want. However, now typing "cd ni<tab>" gives me only
} "nik", and apparently "Nic" no longer matches.
} 
} What am I missing?

Completers are called in order until one of them succeeds.  Because the
_complete call found "nik", _complete:jhcase was never called.

To get both kinds of patterns, you instead need to use a combination of
several styles that can be rather bewildering:

file-patterns and/or tag-order, to divide the matches into tagged groups;
group-order and possibly group-name, for display ordering of the groups;
matcher (not matcher-list), to control which matches are in which group.

This is a start at it:

-------
zstyle ':completion:*:ci-globbed-files' matcher 'm:{a-z}={A-Z}'
zstyle ':completion:*' file-patterns \
  '(#I)%p:globbed-files %p:ci-globbed-files' '*:all-files'
zstyle ':completion:*' group-order globbed-files ci-globbed-files all-files
zstyle ':completion:*' group-name ''
-------

The difficulties are:

- It may work differently when completing in default context than when
  completing after a command such as "ls" that has its own completion
  function defined.  E.g., "ls" somehow ignores the globbed-files group
  and goes directly to ci-globbed-files, I don't know why.

- It's quite difficult to express the concept "only files that match
  case-insensitively, not those that match case-sensitively."  Thus the
  ci-globbed-files group is a superset of globbed-files and you get a
  redundant listing.

- file-patterns are not tried after the first one that has the pattern
  '*:...' which is why the (#I) is thrown in on globbed-files, to force
  attempting both globbed-files and ci-globbed-files even if the match
  pattern substituted by %p is '*'.

Also note that there was at least one dev release where %p was not
handled properly.  I don't recall whether 4.0.7 has that bug.  I tried
the above only with the current CVS incarnation of 4.1.1-dev-1.


  reply	other threads:[~2003-09-14 18:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-14 10:30 Jesper Holmberg
2003-09-14 18:58 ` Bart Schaefer [this message]
2003-09-15 19:08   ` Jesper Holmberg
2003-09-16 17:03     ` Bart Schaefer
2003-09-17  7:30       ` Oliver Kiddle
2003-09-17 14:36         ` Bart Schaefer
2003-09-16 10:09   ` Oliver Kiddle
2003-09-16 11:59     ` Peter Stephenson
2003-09-16 12:17       ` Oliver Kiddle
2003-09-16 12:22         ` Jesper Holmberg
2003-09-17  7:40 ` Oliver Kiddle
2003-09-17 14:43   ` Bart Schaefer
2003-09-17 15:15     ` Oliver Kiddle
2003-09-18 10:26       ` Jesper Holmberg

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=1030914185817.ZM27558@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.dk \
    /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).