branch: master
commit 16eb4a22e1b7b4207f0a6df06d246c0d5caf398c
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
When completing file names, defer to `minibuffer-complete' for "TAB"
* ivy.el (ivy-partial-or-done): Call `minibuffer-complete'. If the
resulting text is a valid directory, move there.
(ivy-read): Setup `minibuffer-completion-table' and
`minibuffer-completion-predicate'. This makes `minibuffer-complete'
work.
Fixes #92
---
ivy.el | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/ivy.el b/ivy.el
index 9b6ef69..fc6759a 100644
--- a/ivy.el
+++ b/ivy.el
@@ -293,10 +293,16 @@ When ARG is t, exit with current text, ignoring the
candidates."
When called twice in a row, exit the minibuffer with the current
candidate."
(interactive)
- (or (ivy-partial)
- (if (eq this-command last-command)
- (ivy-done)
- (ivy-alt-done))))
+ (if (eq (ivy-state-collection ivy-last) 'read-file-name-internal)
+ (progn
+ (minibuffer-complete)
+ (setq ivy-text (ivy--input))
+ (when (file-directory-p ivy-text)
+ (ivy--cd ivy-text)))
+ (or (ivy-partial)
+ (if (eq this-command last-command)
+ (ivy-done)
+ (ivy-alt-done)))))
(defun ivy-partial ()
"Complete the minibuffer text as much as possible."
@@ -685,6 +691,8 @@ RE-BUILDER is a lambda that transforms text into a regex."
(minibuffer-with-setup-hook
#'ivy--minibuffer-setup
(let* ((hist (or history 'ivy-history))
+ (minibuffer-completion-table collection)
+ (minibuffer-completion-predicate predicate)
(res (read-from-minibuffer
prompt
initial-input