emacs/lisp/+vertico.el

25 lines
777 B
EmacsLisp

;;; +vertico.el -*- lexical-binding: t; -*-
;;; Code:
;; https://old.reddit.com/r/emacs/comments/rbmfwk/weekly_tips_tricks_c_thread/hof7rz7/
;; Add this advice to `vertico-next'.
;; Takes care of `vertico-previous' as well, since it calls `vertico-next'.
(defun +vertico-ding-wrap (origin &rest args)
"ADVICE to wrap `vertico-next': ding when wrapping."
(let ((beg-index vertico--index))
(apply origin args)
(unless (eq 1 (abs (- beg-index vertico--index)))
(ding))))
(defun +vertico-widen-or-complete ()
(interactive)
(if (or vertico-unobtrusive-mode
vertico-flat-mode)
(progn (vertico-unobtrusive-mode -1)
(vertico-flat-mode -1))
(call-interactively #'vertico-insert)))
(provide '+vertico)
;;; +vertico.el ends here