From: Bart Schaefer <schaefer@brasslantern.com>
To: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: completer that first expands global aliases (Re: dsf)
Date: Tue, 08 Jan 2013 10:24:04 -0800 [thread overview]
Message-ID: <130108102404.ZM4596@torch.brasslantern.com> (raw)
In-Reply-To: <20130108170145.GA4762@kelebek.lublin.se>
On Jan 8, 6:01pm, Daniel wrote:
}
} If I add the _expand_alias like below, hitting ^Xm gives the expansion with a
} trailing space. And nothing more happens. The hash is the cursor position:
}
} zstyle ':completion:most-recent-*::::' completer _expand_alias _menu _complete _match
}
} $ cat ~/dl/ #
The problem here is that the completer style tries each function in the
list until it finds one that succeeds (returns 0) at which point it
stops. So you need _expand_alias to "fail" (return nonzero).
You can hack this by using a little wrapper function:
_expand_alias_hack() {
_expand_alias "$@"
return 1
}
zstyle ':completion:most-recent-*::::' completer \
_expand_alias_hack _menu _complete _match
However, a cleaner way to do it would be to use the compprefuncs array.
This documentation for this is rather minimal; it's mostly used by the
_next_tags widget to force completion to walk through the tags array.
However, you can use it for oether completers as well.
In this case, you can either create a new widget for the most-recent-*
completion and assign to compprefuncs in the widget, or you can embed it
in the completer style definition by using the -e option:
zstyle -e ':completion:most-recent-*::::' completer \
'compprefuncs=(_expand_alias) reply=(_menu _complete _match)'
Note the quoting, it's important.
--
Barton E. Schaefer
next prev parent reply other threads:[~2013-01-08 18:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-07 10:01 dsf Daniel
2013-01-08 9:41 ` completer that first expands global aliases (Re: dsf) Daniel
2013-01-08 9:58 ` Peter Stephenson
2013-01-08 13:06 ` Oliver Kiddle
2013-01-08 17:01 ` Daniel
2013-01-08 18:24 ` Bart Schaefer [this message]
2013-01-08 21:29 ` Daniel
2013-01-09 4:40 ` Bart Schaefer
2013-01-09 7:29 ` Daniel
2013-01-09 16:05 ` Bart Schaefer
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=130108102404.ZM4596@torch.brasslantern.com \
--to=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).