]> code.delx.au - gnu-emacs-elpa/commitdiff
Add a set of commands for resizing minibuffer height
authorOleh Krehel <ohwoeowho@gmail.com>
Fri, 19 Jun 2015 08:54:04 +0000 (10:54 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Fri, 19 Jun 2015 08:54:04 +0000 (10:54 +0200)
* ivy.el (ivy-minibuffer-grow): New command.
(ivy-minibuffer-shrink): New command.

* ivy-hydra.el (hydra-ivy): Bind "<" and ">".

Use "C-o >>>>>" to grow the minibuffer, and "C-o <<<<<" to shrink it.

Re #151

ivy-hydra.el
ivy.el

index 38a346700205b531c769eed01ef26efacbbc0def..d1ac90eef76216d7b60258c88e1fa605fdc960ad 100644 (file)
@@ -51,7 +51,7 @@
 ^^^^^^^^^^^^^^---------------------------------------
 ^ ^ _k_ ^ ^     _f_ollow  _i_nsert _c_: calling %s(if ivy-calling \"on\" \"off\")
 _h_ ^+^ _l_     _d_one    _o_ops   _m_: matcher %s(if (eq ivy--regex-function 'ivy--regex-fuzzy) \"fuzzy\" \"ivy\")
-^ ^ _j_ ^ ^
+^ ^ _j_ ^ ^     ^ ^       ^ ^      _<_/_>_: shrink/grow window
 "
   ;; arrows
   ("h" ivy-beginning-of-buffer)
@@ -66,7 +66,9 @@ _h_ ^+^ _l_     _d_one    _o_ops   _m_: matcher %s(if (eq ivy--regex-function 'i
   ("d" ivy-done :exit t)
   ("C-m" ivy-done :exit t)
   ("c" ivy-toggle-calling)
-  ("m" ivy-toggle-fuzzy))
+  ("m" ivy-toggle-fuzzy)
+  (">" ivy-minibuffer-grow)
+  ("<" ivy-minibuffer-shrink))
 
 (provide 'ivy-hydra)
 
diff --git a/ivy.el b/ivy.el
index f6bd42c66519811617974fbf6c0f25d04b8d09af..4facc63995508fdb1723ec07f468a517c633cc06 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -422,6 +422,19 @@ If the text hasn't changed as a result, forward to `ivy-alt-done'."
   (interactive)
   (ivy-set-index (max (- ivy--index ivy-height)
                       0)))
+(defun ivy-minibuffer-grow ()
+  "Grow the minibuffer window by 1 line"
+  (interactive)
+  (setq-local max-mini-window-height
+              (cl-incf ivy-height)))
+
+(defun ivy-minibuffer-shrink ()
+  "Shrink the minibuffer window by 1 line."
+  (interactive)
+  (unless (<= ivy-height 2)
+    (setq-local max-mini-window-height
+                (cl-decf ivy-height))
+    (window-resize (selected-window) -1)))
 
 (defun ivy-next-line (&optional arg)
   "Move cursor vertically down ARG candidates."