From 2c950895348b29d262b17f8a6c15679842b9ca19 Mon Sep 17 00:00:00 2001 From: Aleksandr Lebedev Date: Mon, 3 Feb 2025 00:20:37 +0100 Subject: [PATCH] Reenabled vertico, because Fido-mode is unstable --- config.org | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/config.org b/config.org index 6fe4fad..4317828 100644 --- a/config.org +++ b/config.org @@ -56,6 +56,7 @@ - [[#nerd-icons-completion][Nerd Icons Completion]] - [[#buffer-move][Buffer Move]] - [[#completions][Completions]] + - [[#vertico][Vertico]] - [[#orderless][Orderless]] - [[#fido-mode][Fido-mode]] - [[#descriptions][Descriptions]] @@ -1046,6 +1047,52 @@ one, an error is signaled." (select-window other-win)))) #+end_src * Completions +** Vertico +[[https://github.com/minad/vertico][Vertico]] provides a performant and minimalistic vertical completion UI based on the default completion system. +#+begin_src emacs-lisp + ;; Enable vertico + (use-package vertico + :ensure t + :custom + ;; (vertico-scroll-margin 0) ;; Different scroll margin + ;; (vertico-count 20) ;; Show more candidates + ;; (vertico-resize t) ;; Grow and shrink the Vertico minibuffer + (vertico-cycle t) ;; Enable cycling for `vertico-next/previous' + :init + (vertico-mode)) + +(vertico-mode t) ;; enable vertico for all buffers + ;; Persist history over Emacs restarts. Vertico sorts by history position. + (use-package savehist + :init + (savehist-mode)) + + ;; A few more useful configurations... + (use-package emacs + :custom + ;; Support opening new minibuffers from inside existing minibuffers. + (enable-recursive-minibuffers t) + ;; Hide commands in M-x which do not work in the current mode. Vertico + ;; commands are hidden in normal buffers. This setting is useful beyond + ;; Vertico. + (read-extended-command-predicate #'command-completion-default-include-p) + :init + ;; Add prompt indicator to `completing-read-multiple'. + ;; We display [CRM], e.g., [CRM,] if the separator is a comma. + (defun crm-indicator (args) + (cons (format "[CRM%s] %s" + (replace-regexp-in-string + "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" + crm-separator) + (car args)) + (cdr args))) + (advice-add #'completing-read-multiple :filter-args #'crm-indicator) + + ;; Do not allow the cursor in the minibuffer prompt + (setq minibuffer-prompt-properties + '(read-only t cursor-intangible t face minibuffer-prompt)) + (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)) + #+end_src ** Orderless Better searching #+begin_src emacs-lisp @@ -1062,8 +1109,10 @@ one, an error is signaled." (completion-category-overrides '((file (styles partial-completion))))) #+end_src ** Fido-mode -Enables fido completion in emacs. -#+begin_src emacs-lisp +Enables fido completion in emacs. It's actually cool, but... + +Sometimes it hides the last result and it doesn't work good when using app launchers +#+begin_src emacs-lispp (global-completion-preview-mode) (fido-mode t) (savehist-mode t)