]> code.delx.au - gnu-emacs-elpa/commitdiff
ivy.el (ivy-insert-current): Add and bind to "M-i"
authorOleh Krehel <ohwoeowho@gmail.com>
Mon, 15 Jun 2015 10:03:35 +0000 (12:03 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 15 Jun 2015 10:03:35 +0000 (12:03 +0200)
Use "M-i" if you want something close to the current candidate. You can
follow up with an edit and select.

Fixes #141

ivy.el

diff --git a/ivy.el b/ivy.el
index 4e646d0c7f7e4f767f7b4ef266e541df47947443..c81246644ff89ec3717e2f58cc9176847d65017f 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -122,6 +122,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse order."
     (define-key map (kbd "C-M-p") 'ivy-previous-line-and-call)
     (define-key map (kbd "M-q") 'ivy-toggle-regexp-quote)
     (define-key map (kbd "M-j") 'ivy-yank-word)
+    (define-key map (kbd "M-i") 'ivy-insert-current)
     (define-key map (kbd "C-o") 'hydra-ivy/body)
     map)
   "Keymap used in the minibuffer.")
@@ -1344,6 +1345,13 @@ BUFFER may be a string or nil."
     (when amend
       (insert amend))))
 
+(defun ivy-insert-current ()
+  "Make the current candidate into current input.
+Don't finish completion."
+  (interactive)
+  (delete-minibuffer-contents)
+  (insert ivy--current))
+
 (provide 'ivy)
 
 ;;; ivy.el ends here