zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "zsh-users@sunsite.dk" <zsh-users@sunsite.dk>
Subject: Re: Problem with _arguments
Date: Wed, 22 Nov 2006 07:55:10 -0800	[thread overview]
Message-ID: <061122075510.ZM12028@torch.brasslantern.com> (raw)
In-Reply-To: <200611221039.kAMAdpal021905@news01.csr.com>

On Nov 22, 10:39am, Peter Stephenson wrote:
}
} parsing yourself or running _arguments twice.  You can edit words (the
} command line) and CURRENT (the index into it), plus it's also possible
} in some contexts to tell _arguments to limit the words visible in the
} completion that it's calling by the use of enough colons.  I find
} directly manipulating words and CURRENT less infuriating.

Don't forget about compset:

    -n BEGIN [ END ]
          If the current word position as specified by the parameter
          CURRENT is greater than or equal to BEGIN, anything up to the
          BEGIN'th word is removed from the words array and the value
          of the parameter CURRENT is decremented by BEGIN.

          If the optional END is given, the modification is done only if
          the current word position is also less than or equal to END.
          In this case, the words from position END onwards are also
          removed from the words array.

          Both BEGIN and END may be negative to count backwards from
          the last element of the words array.

    -N BEG-PAT [ END-PAT ]
          If one of the elements of the words array before the one at
          the index given by the value of the parameter CURRENT matches
          the pattern BEG-PAT, all elements up to and including the
          matching one are removed from the words array and the value
          of CURRENT is changed to point to the same word in the
          changed array.

          If the optional pattern END-PAT is also given, and there is an
          element in the words array matching this pattern, the
          parameters are modified only if the index of this word is
          higher than the one given by the CURRENT parameter (so that
          the matching word has to be after the cursor). In this case,
          the words starting with the one matching end-pat are also
          removed from the words array. If words contains no word
          matching END-PAT, the testing and modification is performed
          as if it were not given.

So it should work to do something like

	compset -N '[^-]*'

before calling _arguments.


  reply	other threads:[~2006-11-22 15:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <now@bitwi.se>
2006-08-10 20:17 ` Completing a unique prefix of "script" completes "script" Nikolai Weibull
2006-08-10 21:41   ` Peter Stephenson
2006-08-13 14:49     ` Nikolai Weibull
2006-08-14 12:12       ` Peter Stephenson
2006-08-14 22:36         ` Nikolai Weibull
2006-08-13 14:59     ` Nikolai Weibull
2006-08-13 16:34       ` Peter Stephenson
2006-08-13 17:01         ` Nikolai Weibull
2006-11-21 22:57 ` Problem with _arguments Nikolai Weibull
2006-11-21 23:42   ` Peter Stephenson
2006-11-22  8:35     ` Nikolai Weibull
2006-11-22 10:39       ` Peter Stephenson
2006-11-22 15:55         ` Bart Schaefer [this message]
2006-11-22 22:22           ` Nikolai Weibull
2006-11-24 20:56             ` Bart Schaefer
2006-11-22 21:31         ` Nikolai Weibull

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=061122075510.ZM12028@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).