ivy display function

Oleh Krehel edited this page Oct 14, 2016 · 2 revisions

Intro

By default, Ivy displays the candidate list in the minibuffer. However, it’s very easy to make it display where you want: in a different window, or a frame, or an overlay etc.

Example:

(setq ivy-display-function 'ivy-display-function-lv)

The display with lv-message and popup-tip is more of a proof-of-concept; they are provided for reference. The display with ivy-overlay is higher quality and already enabled by default.

Display with ivy-overlay

Here’s a demo of calling C-M-i (complete-symbol) with ivy-mode active. The input and candidates are displayed at point in an overlay.

Demo:

Display candidates with lv

(require 'lv)

(defun ivy-display-function-lv (text)
  (let ((lv-force-update t))
    (lv-message
     (if (string-match "\\`\n" text)
         (substring text 1)
       text))))

Display candidates with popup

(require 'popup)

(defun ivy-display-function-popup (text)
  (with-ivy-window
    (popup-tip
     (setq ivy-insert-debug
           (substring text 1))
     :nostrip t)))