[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 513a77e 67/90: ivy.el (ivy-alt-done): Find file if given a
From: |
Oleh Krehel |
Subject: |
[elpa] master 513a77e 67/90: ivy.el (ivy-alt-done): Find file if given a full tramp path |
Date: |
Tue, 30 Jun 2015 07:29:06 +0000 |
branch: master
commit 513a77eacf3ae3186e05b276539562cac7b46efe
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-alt-done): Find file if given a full tramp path
* ivy.el (ivy-alt-done): Add another cond branch for `ivy-text' matching
a full remote file path.
Re #145
---
ivy.el | 98 ++++++++++++++++++++++++++++++++++------------------------------
1 files changed, 52 insertions(+), 46 deletions(-)
diff --git a/ivy.el b/ivy.el
index a96a4c7..9adf135 100644
--- a/ivy.el
+++ b/ivy.el
@@ -272,52 +272,58 @@ Is is a cons cell, related to
`tramp-get-completion-function'."
"Exit the minibuffer with the selected candidate.
When ARG is t, exit with current text, ignoring the candidates."
(interactive "P")
- (if arg
- (ivy-immediate-done)
- (let (dir)
- (cond ((and ivy--directory
- (or
- (and
- (not (string= ivy--current "./"))
- (cl-plusp ivy--length)
- (file-directory-p
- (setq dir (expand-file-name
- ivy--current ivy--directory))))))
- (ivy--cd dir)
- (ivy--exhibit))
- ((eq (ivy-state-collection ivy-last) 'Info-read-node-name-1)
- (if (or (equal ivy--current "(./)")
- (equal ivy--current "(../)"))
- (ivy-quit-and-run
- (ivy-read "Go to file: " 'read-file-name-internal
- :action (lambda (x)
- (Info-find-node
- (expand-file-name x ivy--directory)
- "Top"))))
- (ivy-done)))
- ((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))
- (setq res (append res (funcall (car x) (cadr x)))))
- (setq res (delq nil res))
- (when user
- (dolist (x res)
- (setcar x user)))
- (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)
- :initial-input rest)))
- (setq ivy-last old-ivy-last)
- (when host
- (setq ivy--directory "/")
- (ivy--cd (concat "/" method ":" host ":"))))))
- (t
- (ivy-done))))))
+ (let (dir)
+ (cond (arg
+ (ivy-immediate-done))
+ ((and ivy--directory
+ (or
+ (and
+ (not (string= ivy--current "./"))
+ (cl-plusp ivy--length)
+ (file-directory-p
+ (setq dir (expand-file-name
+ ivy--current ivy--directory))))))
+ (ivy--cd dir)
+ (ivy--exhibit))
+ ((eq (ivy-state-collection ivy-last) 'Info-read-node-name-1)
+ (if (or (equal ivy--current "(./)")
+ (equal ivy--current "(../)"))
+ (ivy-quit-and-run
+ (ivy-read "Go to file: " 'read-file-name-internal
+ :action (lambda (x)
+ (Info-find-node
+ (expand-file-name x ivy--directory)
+ "Top"))))
+ (ivy-done)))
+ ((and ivy--directory
+ (string-match "\\`/[^/]+:.*:.*\\'" ivy-text))
+ (ivy-done))
+ ((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))
+ (setq res (append res (funcall (car x) (cadr x)))))
+ (setq res (delq nil res))
+ (when user
+ (dolist (x res)
+ (setcar x user)))
+ (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)
+ :initial-input rest)))
+ (setq ivy-last old-ivy-last)
+ (when host
+ (setq ivy--directory "/")
+ (ivy--cd (concat "/" method ":" host ":"))))))
+ (t
+ (ivy-done)))))
(defcustom ivy-tab-space nil
"When non-nil, `ivy-partial-or-done' should insert a space."
- [elpa] master e238286 57/90: "M-n", "M-p", "M-i" should switch directories when needed, (continued)
- [elpa] master e238286 57/90: "M-n", "M-p", "M-i" should switch directories when needed, Oleh Krehel, 2015/06/30
- [elpa] master 3f41ce6 58/90: Put the file instead of partial input on history, Oleh Krehel, 2015/06/30
- [elpa] master 5e3c635 59/90: Add a set of commands for resizing minibuffer height, Oleh Krehel, 2015/06/30
- [elpa] master 7b91a39 60/90: ivy.el (ivy-kill-line): Add and bind to "C-k", Oleh Krehel, 2015/06/30
- [elpa] master dcf0f64 61/90: Add "^" as initial input to "C-h f" and "C-h v", Oleh Krehel, 2015/06/30
- [elpa] master 1ef7e18 62/90: "M-i" should not switch directories, Oleh Krehel, 2015/06/30
- [elpa] master 46695ac 63/90: Fix non-file completions ability to enter tramp completion, Oleh Krehel, 2015/06/30
- [elpa] master a5e49ff 64/90: Make counsel-M-x respect ivy-format-function, Oleh Krehel, 2015/06/30
- [elpa] master 5fcdfb4 65/90: Add better positioning to counsel-git-grep finalizer, Oleh Krehel, 2015/06/30
- [elpa] master 581d8c0 66/90: Don't cut off "/ssh:foo" input, Oleh Krehel, 2015/06/30
- [elpa] master 513a77e 67/90: ivy.el (ivy-alt-done): Find file if given a full tramp path,
Oleh Krehel <=
- [elpa] master 972036c 68/90: ivy.el (ivy-alt-done): Enable recursive minibuffers, Oleh Krehel, 2015/06/30
- [elpa] master d9c4427 69/90: Improve performance for "^" initial input, Oleh Krehel, 2015/06/30
- [elpa] master 2c8ad2a 70/90: Add support for Windows drive letters, Oleh Krehel, 2015/06/30
- [elpa] master d466ade 71/90: Match drive letter at start of current directory, Oleh Krehel, 2015/06/30
- [elpa] master cdb2b1a 72/90: Fix the case where file name can contain ~, Oleh Krehel, 2015/06/30
- [elpa] master 7f97ded 74/90: ivy-hydra.el (hydra-ivy): Bind "C-g", Oleh Krehel, 2015/06/30
- [elpa] master 5c09439 75/90: Re-scale the text height to default in the minibuffer, Oleh Krehel, 2015/06/30
- [elpa] master 321f277 76/90: Fix color blending for composite faces, Oleh Krehel, 2015/06/30
- [elpa] master b12e30c 77/90: Fix last commit being incompatible with older Emacs, Oleh Krehel, 2015/06/30
- [elpa] master 337a1d0 73/90: ivy.el (ivy-initial-inputs-alist): Add some Org commands, Oleh Krehel, 2015/06/30