completion/ivy: show chevron on highlighted item in tty

So its easier to see in the terminal, where some themes may not have a
visible background for the current match.
This commit is contained in:
Henrik Lissner 2020-08-07 23:07:51 -04:00
parent f686e01f4b
commit db7b2f6da9
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 21 additions and 1 deletions

View file

@ -77,6 +77,26 @@ Buffers that are considered unreal (see `doom-real-buffer-p') are dimmed with
((format "%s" val)))
t)))
;;;###autoload
(defun +ivy-format-function-line-or-arrow (cands)
"Transform CANDS into a string for minibuffer.
If in terminal, prefix candidates with a chevron to make it more obvious which
one you're selecting, especially in themes that can't set a good background for
`ivy-current-match'. This is a combination of `ivy-format-function-line' and
`ivy-format-function-arrow'.
In the GUI, this is the same as `ivy-format-function-line'."
(if (display-graphic-p)
(ivy-format-function-line cands)
(ivy--format-function-generic
(lambda (str)
(ivy--add-face (concat "> " str "\n") 'ivy-current-match))
(lambda (str)
(concat " " str "\n"))
cands
"")))
;;
;; Library