From: Peter Stephenson <p.stephenson@samsung.com>
To: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: how to make zsh tab-complete path after colon (instead of just `=`)
Date: Tue, 8 Jan 2019 12:37:31 +0000 [thread overview]
Message-ID: <1546951129.4090.7.camel@samsung.com> (raw)
In-Reply-To: <1546946484.4090.2.camel@samsung.com>
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
next prev parent reply other threads:[~2019-01-08 12:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190108095220epcas2p1220c2b5ad3e9401282d243bcfea7ada1@epcas2p1.samsung.com>
2019-01-08 9:49 ` Timothee Cour
2019-01-08 11:21 ` Peter Stephenson
2019-01-08 12:37 ` Peter Stephenson [this message]
2019-01-08 15:32 ` Daniel Shahaf
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=1546951129.4090.7.camel@samsung.com \
--to=p.stephenson@samsung.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).