branch: master
commit 581d8c050c48964fd4351bdb3d28b078a862bfa4
Author: Oleh Krehel <ohwoeo...@gmail.com>
Commit: Oleh Krehel <ohwoeo...@gmail.com>

    Don't cut off "/ssh:foo" input
    
    * ivy.el (ivy-alt-done): With the example input, offer a completion for
      known remotes with the initial input "foo".
    
    Re #145
---
 ivy.el |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index b105690..a96a4c7 100644
--- a/ivy.el
+++ b/ivy.el
@@ -295,9 +295,10 @@ When ARG is t, exit with current text, ignoring the 
candidates."
                                        (expand-file-name x ivy--directory)
                                        "Top"))))
                (ivy-done)))
-            ((and ivy--directory (string-match 
"\\`/\\([^/]+?\\):\\(?:\\(.*\\)@\\)?" ivy-text))
+            ((and ivy--directory (string-match 
"\\`/\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'" ivy-text))
              (let ((method (match-string 1 ivy-text))
                    (user (match-string 2 ivy-text))
+                   (rest (match-string 3 ivy-text))
                    res)
                (require 'tramp)
                (dolist (x (tramp-get-completion-function method))
@@ -309,7 +310,8 @@ When ARG is t, exit with current text, ignoring the 
candidates."
                (setq res (cl-delete-duplicates res :test #'equal))
                (let ((old-ivy-last ivy-last)
                      (host (ivy-read "Find File: "
-                                     (mapcar #'ivy-build-tramp-name res))))
+                                     (mapcar #'ivy-build-tramp-name res)
+                                     :initial-input rest)))
                  (setq ivy-last old-ivy-last)
                  (when host
                    (setq ivy--directory "/")

Reply via email to