about summary refs log tree commit diff stats
path: root/.emacs.d
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/lisp/init-minibuffer.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el
index 6e6d515..08ce74a 100644
--- a/.emacs.d/lisp/init-minibuffer.el
+++ b/.emacs.d/lisp/init-minibuffer.el
@@ -74,6 +74,14 @@
         (select-window (minibuffer-selected-window))
       (select-window (active-minibuffer-window))))
 
+  ;; Modified from https://github.com/minad/vertico/wiki#update-minibuffer-history-with-candidate-insertions
+  (defadvice vertico-insert
+      (after vertico-insert-add-history activate)
+    "Make vertico-insert add to the minibuffer history."
+    (if (and (not (eq minibuffer-history-variable t))
+             (eq 'file (vertico--metadata-get 'category)))
+        (add-to-history minibuffer-history-variable (minibuffer-contents))))
+
   ;; https://github.com/minad/vertico/wiki#customize-sorting-based-on-completion-category
   (defun sort-directories-first (files)
     ;; Still sort by history position, length and alphabetically