From the Ivy manual:

Customizability is about being able to use different methods and interfaces of completion to tailor the selection process. For example, adding a custom display function that points to a selected candidate with ->, instead of highlighting the selected candidate with the ivy-current-match>>

I've tried to customize the face to look like the one in IDO, with the "->", but to no avail. I can only seem to change the background and font of the face with (ivy-current-match), not manipulate the actual string. Does anyone know?

1 Answer 1


If you want the selected match to be displayed as an arrow, you should customize ivy-format-function, here's the definition:

(defcustom ivy-format-function 'ivy-format-function-default
  "Function to transform the list of candidates into a string.
This string is inserted into the minibuffer."
  :type '(choice
          (const :tag "Default" ivy-format-function-default)
          (const :tag "Arrow prefix" ivy-format-function-arrow)
          (const :tag "Full line" ivy-format-function-line)))

The option that you want is thus:

(setq ivy-format-function 'ivy-format-function-arrow)

If you insist on having -> instead of the default >, look up the definition:

(defun ivy-format-function-arrow (cands)
  "Transform CAND-PAIRS into a string for minibuffer."
   (lambda (str)
     (concat "> " (ivy--add-face str 'ivy-current-match)))
   (lambda (str)
     (concat "  " str))

Copy-paste into your own function:

(defun my-ivy-format-function-arrow (cands)
  "Transform CAND-PAIRS into a string for minibuffer."
   (lambda (str)
     (concat "-> " (ivy--add-face str 'ivy-current-match)))
   (lambda (str)
     (concat "   " str))
(setq ivy-format-function 'my-ivy-format-function-arrow)

If you're not very experienced with Elisp, I recommend to go through M-x customize-group ivy and use the GUI to play around with the parameters.

  • Thank you so much, this was exactly what i was looking for! Mar 27, 2016 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.