zsh-users
 help / color / mirror / code / Atom feed
From: joe M <joe9mail@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-users@zsh.org
Subject: Re: Zsh completion configuration
Date: Tue, 26 Feb 2013 19:41:49 -0500	[thread overview]
Message-ID: <CAHjjW16gsV77y-+BZuQiD0R+=ptMuy5NJ3syXw1sOQzGAdSfeg@mail.gmail.com> (raw)
In-Reply-To: <130226080545.ZM4526@torch.brasslantern.com>

Hello Bart,

Thanks for responding. It works like a charm.

tags in context :completion::complete:-command-::
    history-words
                (_history _history_or_autocd (eval))
    commands builtins functions aliases suffix-aliases reserved-words
jobs parameters  (_alternative _command_names _autocd
_history_or_autocd (eval))
    commands
                (_path_commands _alternative _command_names _autocd
_history_or_autocd (eval))
    path-dirs
                (_path_commands _alternative _command_names _autocd
_history_or_autocd (eval))
    jobs
                (_jobs _alternative _command_names _autocd
_history_or_autocd (eval))
    parameters
                (_parameters _alternative _command_names _autocd
_history_or_autocd (eval))
    local-directories named-directories
                (_alternative _cd _autocd _history_or_autocd (eval))
    users named-directories directory-stack
                (_tilde _alternative _cd _autocd _history_or_autocd
(eval))
    users
                (_users _tilde _alternative _cd _autocd
_history_or_autocd (eval))
tags in context :completion::history:::
    history-words  (_history)

> Unless I'm misunderstanding your intent, you don't actually want to
> change the tags from _command_names -- you just want to add another tag
> that appears in completion output along with the _command_names tags?

yes, that is exactly what I wanted to do.

> And then install it for the context:
>
>     compdef _history_or_autocd -command-

I do not understand the "install" process. Is it good enough to have
the function file (_history_or_autocd) anywhere in the $fpath? Or,
does it have to be after the directory with _autocd?

I added this "zstyle ':completion::complete:-command-:*'
_history_or_autocd" to my zshrc, in addition to deleting my zcompdump
and then running the above "compdef _history_or_autocd -command-"
command. Just a rehash did not do the job. Any thoughts, please?

> To explain a bit further, the completers in the completer style are in
> general attempted until one returns a zero (true, success) status, at
> which point the set of possible matches is assumed to be finished.  To
> merge the results of several completers you have to save the staus, try
> the next one, and then return success if any of those completers was
> successful.
>
> If you instead wanted to complete history and only try the defaults if no
> history words matched, you could have shortcut this as
>
>     compdef '_history || _autocd' -command-
>
> Of course whichever of these you choose has to happen after compinit is
> run, otherwise _autocd will step on it when loaded.

Thanks a lot for the explanation. The code makes so much more sense now.

Thanks again,
Joe


  reply	other threads:[~2013-02-27  0:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25 19:47 joe M
2013-02-26 16:05 ` Bart Schaefer
2013-02-27  0:41   ` joe M [this message]
2013-02-27  3:26     ` Bart Schaefer
2013-02-27 15:54       ` joe M

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='CAHjjW16gsV77y-+BZuQiD0R+=ptMuy5NJ3syXw1sOQzGAdSfeg@mail.gmail.com' \
    --to=joe9mail@gmail.com \
    --cc=schaefer@brasslantern.com \
    --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).