]> code.delx.au - gnu-emacs-elpa/commitdiff
Don't cut off "/ssh:foo" input
authorOleh Krehel <ohwoeowho@gmail.com>
Fri, 19 Jun 2015 12:59:26 +0000 (14:59 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Fri, 19 Jun 2015 12:59:26 +0000 (14:59 +0200)
* ivy.el (ivy-alt-done): With the example input, offer a completion for
  known remotes with the initial input "foo".

Re #145

ivy.el

diff --git a/ivy.el b/ivy.el
index b105690ac29431312a6ff22686cac85bfd0821ec..a96a4c7b12eadaf3f273503b6c4a5acb31bca7cc 100644 (file)
--- 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 "/")