Setup `vertico-mode' again: less is better!

This commit is contained in:
Gerard Vermeulen 2024-06-15 14:29:44 +02:00
parent 8faffd1fdb
commit 50b3fe6bf2

View File

@ -1267,28 +1267,34 @@ completion in any buffer.
:CUSTOM_ID: sec:vertico-configuration
:END:
Listing [[lst:setup-vertico-mode]] sets up =fido-mode= and =vertico-mode=. Listing
See the [[yt:hPwDbx--Waw][Vertico extensions for Emacs]] video for an overview. Listing
[[lst:setup-vertico-mode]] sets up =vertico-mode= without using the
=vertico-directory= extension (less is better!). Listing
[[lst:prune-file-name-history]] allows to prune non-existing files from the file
name history. NOTE: The src_emacs-lisp{(describe-function 'savehist-mode)}
documentation explains why it is best to turn on =savehist-mode= in the
=user-init-file=. BUG: Adding ~kill-ring~ to ~savehist-additional-variables~
does not save ~kill-ring~ from an Emacs session to the next session, contrary to
the src_emacs-lisp{(describe-variable 'savehist-additional-variables)}
name history.
NOTE: Play with =vertico-buffer-mode=, =vertico-flat-mode=, =vertico-grid-mode=,
=vertico-indexed-mode=, =vertico-mouse-mode= (not easy to use with my trackpad),
=vertico-reverse-mode=.
NOTE: The src_emacs-lisp{(describe-function 'savehist-mode)} documentation
explains why it is best to turn on =savehist-mode= in =user-init-file=.
BUG: Adding ~kill-ring~ to ~savehist-additional-variables~ does not save
~kill-ring~ from an Emacs session to the next session, contrary to the
src_emacs-lisp{(describe-variable 'savehist-additional-variables)}
documentation.
#+caption[Enable =fido-mode= and =vertico-mode=]:
#+caption: Enable =fido-mode= and =vertico-mode=.
#+caption[Setup =vertico-mode=]:
#+caption: Setup =vertico-mode=.
#+name: lst:setup-vertico-mode
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'vertico)
;; ChatGPT: Builtin `fido-mode' fixes `find-file' completion here.
(fido-mode +1)
(vertico-mode +1)
;; GOOD: Builtin `fido-mode' improves the feel of the completion.
;; UGLY: Builtin `fido-mode' adds a visually superfluous extra line.
(keymap-set vertico-map "DEL" #'vertico-directory-delete-char)
(keymap-set vertico-map "M-DEL" #'vertico-directory-delete-word)
(keymap-set vertico-map "RET" #'vertico-directory-enter))
;; GAV: Builtin `fido-mode' may fix `find-file' completion when
;; using `vertico-directory' functions which confuse `find-file'.
;; GAV: Builtin `fido-mode' improves the feel of the completion
;; (good), but adds an extra line to the minibuffer bottom (ugly).
(vertico-mode +1))
#+end_src
#+caption[Prune non-existing files from =file-name-history=]:
@ -1314,9 +1320,6 @@ documentation.
|-------------------------------+----------------------------------+---------------------|
| command | remap | keys |
|-------------------------------+----------------------------------+---------------------|
| vertico-directory-delete-char | | {{{kbd(DEL)}}} |
| vertico-directory-delete-word | | {{{kbd(M-DEL)}}} |
| vertico-directory-enter | | {{{kbd(RET)}}} |
| vertico-exit | exit-minibuffer | {{{kbd(C-j)}}} |
| vertico-exit-input | | {{{kbd(C-RET)}}} |
| vertico-first | beginning-of-buffer | {{{kbd(M-<)}}} |