zsh-users
 help / color / mirror / code / Atom feed
* zsh versus tcsh's "complete=enhance"
@ 2006-04-30 16:01 Jörgen Grahn
  2006-05-01  9:40 ` Stephane Chazelas
  2006-05-01 15:28 ` Thorsten Kampe
  0 siblings, 2 replies; 5+ messages in thread
From: Jörgen Grahn @ 2006-04-30 16:01 UTC (permalink / raw)
  To: zsh-users

Hi,

Before I switched from tcsh (used it for approximately fifteen years) to zsh,
I depended heavily on the complete=enhance setting. From tcsh(1):

    If the complete shell variable is set to enhance', completion 1) ignores
    case and 2) considers periods, hyphens and underscores (.', -' and _')
    to be word separators and hyphens and underscores to be equivalent.

For example, ~/News/c.o.l.an might expand to ~/News/Comp.os.linux.announce.
And it works on commands too: s_ad expands to ssh-add.

Zsh has the case-insensitive part of it, which is nice. How about the rest?
I googled around a bit, but I have only seen the question raised (as early
as in 1997), not answered.

And part two of the question: if it doesn't exist, and I want to hack it on
my copious spare time, where should I start? I have no problem implementing
the algorithm (string, fs) -> list of matches, but zsh is so large that I
wouldn't know where to place it. Or if it should be done in some command
language rather than C.

And by the way, thanks for a very nice interactive shell!

BR,
Jörgen
(not on the mailing lists, so I'd appreciate a Cc:)

-- 
  // Jörgen Grahn       "Koka lopplummer, bada Ross, loppor borta."
\X/ <grahn@snipabacken.dyndns.org>                        -- Jonas


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

* Re: zsh versus tcsh's "complete=enhance"
  2006-04-30 16:01 zsh versus tcsh's "complete=enhance" Jörgen Grahn
@ 2006-05-01  9:40 ` Stephane Chazelas
  2006-05-01 15:28 ` Thorsten Kampe
  1 sibling, 0 replies; 5+ messages in thread
From: Stephane Chazelas @ 2006-05-01  9:40 UTC (permalink / raw)
  To: zsh-users

On Sun, Apr 30, 2006 at 06:01:05PM +0200, Jörgen Grahn wrote:
> Hi,
> 
> Before I switched from tcsh (used it for approximately fifteen years) to zsh,
> I depended heavily on the complete=enhance setting. From tcsh(1):
> 
>     If the complete shell variable is set to enhance', completion 1) ignores
>     case and 2) considers periods, hyphens and underscores (.', -' and _')
>     to be word separators and hyphens and underscores to be equivalent.
> 
> For example, ~/News/c.o.l.an might expand to ~/News/Comp.os.linux.announce.
> And it works on commands too: s_ad expands to ssh-add.
[...]

Go through compinstall again, there's a menu entry exactly for
that (menu entry "2", then "p" for partial matching, you can
specify the characters).

Search for "partial-word completion" in the manual.

-- 
Stephane


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

* Re: zsh versus tcsh's "complete=enhance"
  2006-04-30 16:01 zsh versus tcsh's "complete=enhance" Jörgen Grahn
  2006-05-01  9:40 ` Stephane Chazelas
@ 2006-05-01 15:28 ` Thorsten Kampe
  2006-05-01 21:06   ` zsh versus tcsh's "complete=enhance" (for Germans) Andy Spiegl
  1 sibling, 1 reply; 5+ messages in thread
From: Thorsten Kampe @ 2006-05-01 15:28 UTC (permalink / raw)
  To: zsh-users

* Jörgen Grahn (2006-04-30 17:01 +0000)
> Before I switched from tcsh (used it for approximately fifteen years) to zsh,
> I depended heavily on the complete=enhance setting. From tcsh(1):
> 
>     If the complete shell variable is set to enhance', completion 1) ignores
>     case and 2) considers periods, hyphens and underscores (.', -' and _')
>     to be word separators and hyphens and underscores to be equivalent.
> 
> For example, ~/News/c.o.l.an might expand to ~/News/Comp.os.linux.announce.
> And it works on commands too: s_ad expands to ssh-add.
> 
> Zsh has the case-insensitive part of it, which is nice. How about the rest?
> I googled around a bit, but I have only seen the question raised (as early
> as in 1997), not answered.

I have this in my .zshrc:

# case-insensitive and partial-word then substring
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z} m:[-._]=[-._] r:|[-./_]=** r:|=*' '+l:|=*'

Thorsten


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

* Re: zsh versus tcsh's "complete=enhance" (for Germans)
  2006-05-01 15:28 ` Thorsten Kampe
@ 2006-05-01 21:06   ` Andy Spiegl
  2006-05-02  9:56     ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Spiegl @ 2006-05-01 21:06 UTC (permalink / raw)
  To: zsh-users

Hi Thorsten,

for case-insensitive German I am using this:
 zstyle ":completion:*" matcher-list 'm:{A-Zöäüa-zÖÄÜ}={a-zÖÄÜA-Zöäü}'

Is there a shorter way to write this?

Chau,
 Andy.

-- 
 "How to make a million dollars:  First, get a million dollars."
   -- Steve Martin


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

* Re: zsh versus tcsh's "complete=enhance" (for Germans)
  2006-05-01 21:06   ` zsh versus tcsh's "complete=enhance" (for Germans) Andy Spiegl
@ 2006-05-02  9:56     ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2006-05-02  9:56 UTC (permalink / raw)
  To: zsh-users

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]

Andy Spiegl wrote:
> for case-insensitive German I am using this:
>  zstyle ":completion:*" matcher-list 'm:{A-Zöäüa-zÖÄÜ}={a-zÖÄÜA-Zöäü}'
>
> Is there a shorter way to write this?

It looks like equivalence classes (the braces in that pattern) for
completion matchers are fairly simply handled at present.  The code for
this part of the matching appears (for once) not to be too tortuous and
it ought to be possible to extend it.

You probably want to be able to do something like
'm:{[:upper:]}={[:lower:]}' in a manner similar to ranges in normal
pattern matching.  This ought to be doable by having isupper() tests and
tolower() conversions.  However, I haven't looked at the details.

The matcher code uses multibyte strings rather than wide characters, so
it looks like yet another conversion would be needed.  Probably the
matcher code is better done entirely with wide characters, but that
requires understanding it first...

Any further details should probably go to zsh-workers.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

end of thread, other threads:[~2006-05-02  9:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-30 16:01 zsh versus tcsh's "complete=enhance" Jörgen Grahn
2006-05-01  9:40 ` Stephane Chazelas
2006-05-01 15:28 ` Thorsten Kampe
2006-05-01 21:06   ` zsh versus tcsh's "complete=enhance" (for Germans) Andy Spiegl
2006-05-02  9:56     ` Peter Stephenson

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