From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: ordering of file-patterns completions
Date: Thu, 07 Nov 2013 07:06:40 -0800 [thread overview]
Message-ID: <131107070640.ZM20932@torch.brasslantern.com> (raw)
In-Reply-To: <527B336A.40506@gmail.com>
On Nov 6, 11:30pm, John wrote:
} >
} > If there's nothing but options, for example, then you can probably do:
} >
} > local first_file=$(( ${words[(I)-*]} + 1 ))
} >
} The first one nearly does it, but seems to be confused when there are no
} options at all.
Ah, yes. Because it's counting backwards it will run down to zero if it
finds nothing. I listed that one first because it was the simplest
expression, but I should have stuck with the second one:
} > local first_file=$(( ${${words[2,-1]}[(i)[^-]*]} + 1 ))
[...]
} I ended up adding:
}
} if [[ $first_file -lt 2 ]]; then
} first_file=2
} fi
}
} And that fixed it. Not realizing that the array was 1-based threw me
} for a bit. I also changed the :x to a :e, as :x just gave me an error,
} and :e matched the description of what I think you had meant.
Oops, yes, I did mean :e. Typo'd it earlier and then just kept copy-
pasting.
prev parent reply other threads:[~2013-11-07 15:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 15:24 John
2013-11-06 16:03 ` Bart Schaefer
2013-11-07 1:11 ` John
2013-11-07 4:17 ` Bart Schaefer
2013-11-07 6:30 ` John
2013-11-07 15:06 ` Bart Schaefer [this message]
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=131107070640.ZM20932@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).