Fancy minibuffer faces for Ivy completion
04 Sep 2015Today, I'll describe a recent improvement to the display of Ivy completion. To use it, add this code to your configuration:
(setq ivy-display-style 'fancy)
After this, swiper will look like this:
And counsel-M-x
will look like this:
If you haven't used it before, counsel-M-x
is part the counsel
package on MELPA, or part of swiper package if you're installing from
GNU ELPA. Basically, it's a M-x replacement (that I like to
bind to C-t for efficiency reasons), that doubles as
find-function
(just press C-. instead of RET
to find the function instead of calling it). If you're using
counsel-M-x
I highly recommend to also install smex
, since then
counsel-M-x
will use smex
for sorting the matched commands.
The update will propertize the minibuffer contents with a new set of faces:
(defcustom swiper-minibuffer-faces
'(swiper-minibuffer-match-face-1
swiper-minibuffer-match-face-2
swiper-minibuffer-match-face-3
swiper-minibuffer-match-face-4)
"List of `swiper' faces for minibuffer group matches.")
Initially, when responding to #212, I used the original swiper faces in the minibuffer as well. But after some use, their brightness became a bit annoying. So I introduced a new set of faces that can be customized separately.
Here are the settings that I'm currently using:
(custom-set-faces
'(swiper-minibuffer-match-face-1
((t :background "#dddddd")))
'(swiper-minibuffer-match-face-2
((t :background "#bbbbbb" :weight bold)))
'(swiper-minibuffer-match-face-3
((t :background "#bbbbff" :weight bold)))
'(swiper-minibuffer-match-face-4
((t :background "#ffbbff" :weight bold))))
It's similar to what the Firefox address bar uses: gray background and bold font. Additionally, the matching parts are highlighted with pale gray, blue and magenta colors. If you like the color scheme, it's part of eclipse-theme. Another choice, for even less distraction, could be to remove the background from these faces, only leaving the bold part on the matches.
Thanks to @Wilfred for nudging me to finally implement this feature. It's been on my list for a long time, but I've been putting it off.