zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Jonas Juselius <jonas@iki.fi>, zsh-users@sunsite.dk
Subject: Re: zstyle problems
Date: Wed, 2 Oct 2002 08:33:29 +0000	[thread overview]
Message-ID: <1021002083329.ZM16730@candle.brasslantern.com> (raw)
In-Reply-To: <20021002075023.GA802@chem.helsinki.fi>

On Oct 2, 10:50am, Jonas Juselius wrote:
} Subject: Re: zstyle problems
}
} I still think this is a bit confusing. Typing 'cd' and then pressing
} ^Xh says 'tags in context :completion::complete:cd::', which made me
} think that this was the actual context...

It is the context for the tags (hence "tags in context ..."), but not the
context for any old style that has nothing to do with tags.

I agree that it's confusing at first, but this is the way the system is
structured; because it isn't just based on simply completing after a
known command name any more, there has to be a way to bootstrap it.  The
completers are what figure out the full context by examining the command
line in detail (among other things that they do).

} What would be the correct way of defining different (individual)
} completions for 'cd' and other commands?

There's a difference between defining completions (which is done with
compdef and a function) and defining completion behaviors (which is done
with zstyles for completers and tags).  Some completers implement other
special styles (like max-errors for _correct) to adjust their behavior,
but there isn't direct support for changing the entire set of completers
based on the command name, because of the bootstrapping issue.

However, there's an example in the documentation under the _approximate
completer that shows how to change the entire list of completers based on
a condition of your own invention.  (Hmm, I just noticed that example is
missing a "-e" flag in the "zstyle" command.  Doc typo.)  You'd want
something like

    zstyle -e ':completion::*' completer '\
      case $words[1] in
      (cd|chdir) reply=(_complete);;
      (*) reply=(_complete _correct _approximate);;
      esac'

} Ok, I tried this but I didn't see any difference from the standard
} completion...

I presume you mean you tried *this*:

} >     zstyle ':completion::complete:-tilde-:*' tag-order \
} > 	    named-directories users directory-stack

} Could this have something to do with menu completion and sorting?

You want to look at the group-order style, and its partner group-name,
as well as tag-order.  If you haven't already, add to you .zshrc:

    zstyle ':completion:*' group-name ''

and see if that doesn't change something.  Then start experimenting
with group-order.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  parent reply	other threads:[~2002-10-02  8:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-01 11:34 Jonas Juselius
2002-10-01 11:43 ` Jonas Juselius
2002-10-02  3:15 ` Bart Schaefer
2002-10-02  7:50   ` Jonas Juselius
2002-10-02  8:16     ` Borzenkov Andrey
2002-10-02  8:33     ` Bart Schaefer [this message]
2002-10-02  9:28       ` Jonas Juselius

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=1021002083329.ZM16730@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=jonas@iki.fi \
    --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).