]> code.delx.au - gnu-emacs-elpa/commitdiff
ivy-hydra.el: Bind "t" to toggle-truncate-lines
authorOleh Krehel <ohwoeowho@gmail.com>
Fri, 2 Oct 2015 10:30:54 +0000 (12:30 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Fri, 2 Oct 2015 10:30:54 +0000 (12:30 +0200)
* ivy.el (ivy-format-function-default): When `truncate-lines' is non-nil
  don't truncate with "...".

Use "C-o t" when you complete very long lines and want to see them
whole.

Fixes #214

ivy-hydra.el
ivy.el

index 6ab1f9aebe79a8cf0daa0e702d251fea01d3da15..152812b3e808c4ea1cb6be79cc110eab94b81637 100644 (file)
 (defhydra hydra-ivy (:hint nil
                      :color pink)
   "
-^^^^^^          ^Yes^     ^No^     ^Maybe^           ^Action^
+^^^^^^          ^Yes^     ^No^     ^Maybe^            ^Action^
 ^^^^^^^^^^^^^^---------------------------------------------------
-^ ^ _k_ ^ ^     _f_ollow  _i_nsert _c_: calling %s(if ivy-calling \"on\" \"off\")  _w_/_s_: %s(ivy-action-name)
+^ ^ _k_ ^ ^     _f_ollow  _i_nsert _c_: calling %s(if ivy-calling \"on\" \"off\")   _w_/_s_: %s(ivy-action-name)
 _h_ ^+^ _l_     _d_one    _o_ops   _m_: matcher %s(if (eq ivy--regex-function 'ivy--regex-fuzzy) \"fuzzy\" \"ivy\")
-^ ^ _j_ ^ ^     _g_o      ^ ^      _<_/_>_: shrink/grow window
+^ ^ _j_ ^ ^     _g_o      ^ ^      _<_/_>_: shrink/grow _t_runcate: %`truncate-lines
 "
   ;; arrows
   ("h" ivy-beginning-of-buffer)
@@ -73,7 +73,8 @@ _h_ ^+^ _l_     _d_one    _o_ops   _m_: matcher %s(if (eq ivy--regex-function 'i
   (">" ivy-minibuffer-grow)
   ("<" ivy-minibuffer-shrink)
   ("w" ivy-prev-action)
-  ("s" ivy-next-action))
+  ("s" ivy-next-action)
+  ("t" (setq truncate-lines (not truncate-lines))))
 
 (provide 'ivy-hydra)
 
diff --git a/ivy.el b/ivy.el
index 25ea6c6aee971363a10f07d9e342e6220173e9a4..bf3981a989349b17cc1ccc99a3cefd2d2dcafa1b 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1568,10 +1568,12 @@ This string will be inserted into the minibuffer.")
     (let ((ww (- (window-width)
                  (if (and (boundp 'fringe-mode) (eq fringe-mode 0)) 1 0))))
       (mapconcat
-       (lambda (s)
-         (if (> (length s) ww)
-             (concat (substring s 0 (- ww 3)) "...")
-           s))
+       (if truncate-lines
+           (lambda (s)
+             (if (> (length s) ww)
+                 (concat (substring s 0 (- ww 3)) "...")
+               s))
+         #'identity)
        cands "\n"))))
 
 (defun ivy-format-function-arrow (cands)