Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] _hosts: allow overriding the default matching control



<balejk> Hello, how can I make zsh only complete the prefix for remote
hosts when there are multiple matches with common prefix and suffix? ie
"ssh te<Tab>" should only complete "ssh test" when there are "test1.org"
and "test2.org, instead it completes "ssh test.org" and leaves the
cursor before the dot.

<Mikachu> for some reason that is hardcoded in _hosts

<llua> yeah, -M needs to be moved after the "$@" to allow the matcher
style to ignore it
<llua> zstyle :completion::complete:ssh:\*:hosts  matcher x:
---
 Completion/Unix/Type/_hosts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Completion/Unix/Type/_hosts b/Completion/Unix/Type/_hosts
index 4057fee10..d242e2931 100644
--- a/Completion/Unix/Type/_hosts
+++ b/Completion/Unix/Type/_hosts
@@ -75,4 +75,4 @@ if ! zstyle -a ":completion:${curcontext}:hosts" hosts _hosts; then
 fi

 _wanted hosts expl host \
-    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' -a "$@" - _hosts
+    compadd -a "$@" -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' - _hosts
--
2.49.0





Messages sorted by: Reverse Date, Date, Thread, Author