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 :CUSTOM_ID: sec:vertico-configuration
:END: :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 [[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)} name history.
documentation explains why it is best to turn on =savehist-mode= in the
=user-init-file=. BUG: Adding ~kill-ring~ to ~savehist-additional-variables~ NOTE: Play with =vertico-buffer-mode=, =vertico-flat-mode=, =vertico-grid-mode=,
does not save ~kill-ring~ from an Emacs session to the next session, contrary to =vertico-indexed-mode=, =vertico-mouse-mode= (not easy to use with my trackpad),
the src_emacs-lisp{(describe-variable 'savehist-additional-variables)} =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. documentation.
#+caption[Enable =fido-mode= and =vertico-mode=]: #+caption[Setup =vertico-mode=]:
#+caption: Enable =fido-mode= and =vertico-mode=. #+caption: Setup =vertico-mode=.
#+name: lst:setup-vertico-mode #+name: lst:setup-vertico-mode
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'vertico) (when (ensure-package-installation 'vertico)
;; ChatGPT: Builtin `fido-mode' fixes `find-file' completion here. ;; GAV: Builtin `fido-mode' may fix `find-file' completion when
(fido-mode +1) ;; using `vertico-directory' functions which confuse `find-file'.
(vertico-mode +1) ;; GAV: Builtin `fido-mode' improves the feel of the completion
;; GOOD: Builtin `fido-mode' improves the feel of the completion. ;; (good), but adds an extra line to the minibuffer bottom (ugly).
;; UGLY: Builtin `fido-mode' adds a visually superfluous extra line. (vertico-mode +1))
(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))
#+end_src #+end_src
#+caption[Prune non-existing files from =file-name-history=]: #+caption[Prune non-existing files from =file-name-history=]:
@ -1314,9 +1320,6 @@ documentation.
|-------------------------------+----------------------------------+---------------------| |-------------------------------+----------------------------------+---------------------|
| command | remap | keys | | 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 | exit-minibuffer | {{{kbd(C-j)}}} |
| vertico-exit-input | | {{{kbd(C-RET)}}} | | vertico-exit-input | | {{{kbd(C-RET)}}} |
| vertico-first | beginning-of-buffer | {{{kbd(M-<)}}} | | vertico-first | beginning-of-buffer | {{{kbd(M-<)}}} |