zsh-workers
 help / color / mirror / code / Atom feed
From: Domagoj Pintaric <domagoj.pintaric@gmail.com>
To: zsh-workers@zsh.org
Subject: Custom auto complete
Date: Sun, 3 Aug 2014 18:17:51 +0200	[thread overview]
Message-ID: <CALGc2BqUd30HFx0hOjXLY7hyLOKcT1E9-fj87uS+KupiB7ru-Q@mail.gmail.com> (raw)

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

Hello,

I wold like to write my own zsh auto complete function/code but i need some
reference to start with. This is is what i want to do:

I wold like to parse the command that is currently typed and if there is a
"?" char followed by a <TAB> key press to show a menu of options to
compete. So for example if I start typing:

> cp ?<TAB>

i would like zsh to shows me a menu of strings to replace the "?" char
with. Options would also have to be numerated so it would possible to write:

>cp ?1<TAB>

The strings I would like to be displayed would be stored in a file.

If found some tutorials on how to write my own auto complete functions but
the problem is I want this to work anywhere in the command string that is
currently typed not just if i start with that command.

I understand that the "?" char might have to be escaped or something but
it's not important that the "trigger" char is "?" it can be something else.

So my question is how do i get zsh to display a custom auto complete menu
when I press <TAB> and the previous char is, for example, "?".

Regards,
Domagoj

             reply	other threads:[~2014-08-03 16:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-03 16:17 Domagoj Pintaric [this message]
2014-08-04 20:39 ` Bart Schaefer
2014-08-04 20:57   ` Bart Schaefer
2014-08-05 22:37     ` Domagoj Pintaric
2014-08-06  3:45       ` 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=CALGc2BqUd30HFx0hOjXLY7hyLOKcT1E9-fj87uS+KupiB7ru-Q@mail.gmail.com \
    --to=domagoj.pintaric@gmail.com \
    --cc=zsh-workers@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).