]> code.delx.au - gnu-emacs-elpa/commitdiff
"M-i" should not switch directories
authorOleh Krehel <ohwoeowho@gmail.com>
Fri, 19 Jun 2015 11:39:33 +0000 (13:39 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Fri, 19 Jun 2015 11:40:39 +0000 (13:40 +0200)
ivy.el (ivy-insert-current): When the current candidate is a directory,
just insert its name without the last "/". The user can insert "/" to
switch to that directory if necessary.

Re #141

ivy.el

diff --git a/ivy.el b/ivy.el
index 615b476337a8543b7b6f99b8f521e4fa9aba8c8c..08b6528f417a344af68c3df35b6fc5e360b836e1 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1409,8 +1409,10 @@ BUFFER may be a string or nil."
 Don't finish completion."
   (interactive)
   (delete-minibuffer-contents)
-  (insert ivy--current)
-  (ivy--cd-maybe))
+  (if (and ivy--directory
+           (string-match "/$" ivy--current))
+      (insert (substring ivy--current 0 -1))
+    (insert ivy--current)))
 
 (defun ivy-toggle-fuzzy ()
   "Toggle the re builder between `ivy--regex-fuzzy' and `ivy--regex-plus'."