zsh-users
 help / color / mirror / code / Atom feed
* Completion introspection
@ 2020-05-31  8:44 Roman Perepelitsa
  2020-06-01  8:07 ` Daniel Shahaf
  0 siblings, 1 reply; 5+ messages in thread
From: Roman Perepelitsa @ 2020-05-31  8:44 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]

What's the best way to retrieve the current completion word, tags and
contexts from a zle widget?

For example, suppose I type this:

  ls ~/foo/

If I now invoke _complete_help via its default ^X^H binding, I see this:

  tags in context :completion::complete:ls::
      argument-rest options  (_arguments _ls)
  tags in context :completion::complete:ls:argument-rest:
      globbed-files  (_files _arguments _ls)

I'd like to define a regular zle widget (not a completion widget) and am
looking for a way to retrieve:

  - the word that would be completed if I pressed tab: ~/foo/
  - the first context: :completion::complete:ls::
  - tags from the last context: globbed-files

Preferably this should be fast. If possible, I'd like to avoid the
generation of completion candidates (no globbing of ~/foo/* in this
example).

If some of these are easier to retrieve than others, I could do with a
subset. E.g., just the word would already be useful. Or just the first
context. Or just the tags from the last context.

Roman.

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

end of thread, other threads:[~2020-07-01 17:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-31  8:44 Completion introspection Roman Perepelitsa
2020-06-01  8:07 ` Daniel Shahaf
2020-06-01  8:22   ` Roman Perepelitsa
2020-06-02 13:43     ` Oliver Kiddle
2020-07-01 17:46       ` Roman Perepelitsa

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