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

Re: Re: [PATCH] _git: don't treat URI schemes as scp-style remotes



Oh, I agree that this approach is a better solution. Thank you for your work and looking forward to the update!

On 7/15/26 9:59 AM, dana wrote:
On Tue 14 Jul 2026, at 19:39, LY wrote:
+    # Completing the host part: do not offer a bare URI scheme as an scp host.
+    [[ $PREFIX == (#i)(http|https|ftp|ftps|git|ssh|file) ]] && return 1
this prevents it from completing a host like 'github.com'

i had started working on a re-design of _urls that would help here but
we'll have to see if i can focus on one thing long enough to finish it

in the mean time, there are lots of options, but maybe more like this?

dana


diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index c4ed3c3e9..9d522362a 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -8137,10 +8137,20 @@ __git_tree_files () {
(( $+functions[__git_remote_repositories] )) ||
  __git_remote_repositories () {
-  if compset -P '*:'; then
+  if compset -P ssh://; then
+    if compset -P 1 '*/'; then
+      _remote_files -h ${${${IPREFIX#*//}#*@}%/} -W / -/ -- ssh
+    else
+      compset -P '*@'
+      _ssh_hosts -r/ -S/
+    fi
+  elif [[ $PREFIX == *://* ]]; then
+    _urls
+  elif compset -P '*:'; then
      _remote_files -/ -- ssh
    else
-    _ssh_hosts -S:
+    compset -P '*@'
+    _ssh_hosts -r: -S:
    fi
  }





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