Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: how to make zsh tab-complete path after colon (instead of just `=`)
- X-seq: zsh-users 23829
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Subject: Re: how to make zsh tab-complete path after colon (instead of just `=`)
- Date: Tue, 8 Jan 2019 12:37:31 +0000
- Accept-language: en-GB, en-US
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190108123851euoutp0127e442914615cd8433b011648c83284a~339urQu6Y1571715717euoutp01a
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1546951131; bh=Gs9IaaGPM9Olxu/3PKaVzRg1xhooNvtR3ze74aqIPNs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=R1LErtu79xQic4fgRTFRWC451JUiB1bDeTBNssqXPKUYypHJyAdDQw56hCL//EFoL f1o9B21L4196p5sSHnK8DOKbKPXVK6JNBUR7noxkZ8/DTTJQJsP2M5x1l10anneo4U iGpJFW7+YRGIZq8MDkndxp3XjOf+DdTndLEaPIVk=
- In-reply-to: <1546946484.4090.2.camel@samsung.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CGME20190108095220epcas2p1220c2b5ad3e9401282d243bcfea7ada1@epcas2p1.samsung.com> <CANri+EwBAn0zjbQ6rbRjixXVRqqv3fE2Y3VMSvDhAy+t35zBPg@mail.gmail.com> <1546946484.4090.2.camel@samsung.com>
- Thread-index: AQHUp07sRAAskeTq0E+K0s0+R/461Q==
- Thread-topic: how to make zsh tab-complete path after colon (instead of just `=`)
On Tue, 2019-01-08 at 11:21 +0000, Peter Stephenson wrote:
> If you really want a brutal answer, however, it's not so hard to add a
> style that will allow you to split all file completions on a given set
> of characters. The following simple patch allows you to set
>
> zstyle ':completion:*' file-split-chars :
I'm told this is probably good enough, and it's certainly not a big
change, and it's safe if you don't have the style set, so we might as
well get it in. Someone may see some useful tweaks, e.g. it's quite
possible I haven't taken account of quoting properly. Here's a full
patch with documentation.
pws
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index 9fa6ae9..1021c34 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -2,6 +2,11 @@
local -a match mbegin mend
+local splitchars
+if zstyle -s ":completion:${curcontext}:" file-split-chars splitchars; then
+ compset -P "*[${(q)splitchars}]"
+fi
+
# Look for glob qualifiers. Do this first: if we're really
# in a glob qualifier, we don't actually want to expand
# the earlier part of the path. We can't expand inside
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index a5a9e5b..3ce1c8c 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1568,6 +1568,16 @@ contains the string `tt(follow)', timestamps are associated with the
targets of symbolic links; the default is to use the timestamps
of the links themselves.
)
+kindex(file-split-chars, completion style)
+item(tt(file-split-chars))(
+A set of characters that will cause em(all) file completions for
+the given context to be split at the point where any of the characters
+occurs. A typical use is to set the style to tt(:); then everything
+up to and including the last tt(:) in the string so far is ignored when
+completing files. As this is quite heavy-handed, it is usually
+preferable to update completion functions for contexts where this
+behaviour is useful.
+)
kindex(filter, completion style)
item(tt(filter))(
The tt(ldap) plugin of email address completion (see tt(_email_addresses)) uses
Messages sorted by:
Reverse Date,
Date,
Thread,
Author