From afab2193fc3c509cf70c7e8774cda0551e78c1e1 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Tue, 30 May 2023 10:36:08 +0200 Subject: [PATCH] add arrow to mark current candidate --- lisp/init-smarter-than-emacs.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lisp/init-smarter-than-emacs.el b/lisp/init-smarter-than-emacs.el index fb5c489..58eda61 100644 --- a/lisp/init-smarter-than-emacs.el +++ b/lisp/init-smarter-than-emacs.el @@ -70,6 +70,23 @@ a remote file anytime and from everywhere I am by just entering :" (delete-char -1))) (delete-char -1))) + ;; via vertico wiki, prefix current candidate with an arrow + (defvar +vertico-current-arrow t) + (cl-defmethod vertico--format-candidate :around + (cand prefix suffix index start &context ((and +vertico-current-arrow + (not (bound-and-true-p vertico-flat-mode))) + (eql t))) + (setq cand (cl-call-next-method cand prefix suffix index start)) + (if (bound-and-true-p vertico-grid-mode) + (if (= vertico--index index) + (concat #("▶" 0 1 (face vertico-current)) cand) + (concat #("_" 0 1 (display " ")) cand)) + (if (= vertico--index index) + (concat + #(" " 0 1 (display (left-fringe right-triangle vertico-current))) + cand) + cand))) + :bind (:map vertico-map ("~" . tvd-vertico-jump-home) (":" . tvd-vertico-jump-ssh)