Add a vertico module
This commit is contained in:
parent
e83f905cdb
commit
b70ecb4ba0
5 changed files with 128 additions and 2 deletions
|
@ -13,6 +13,7 @@
|
||||||
* Auto-install `racket-mode` if needed.
|
* Auto-install `racket-mode` if needed.
|
||||||
* Add a F# module.
|
* Add a F# module.
|
||||||
* Auto-install `use-package`.
|
* Auto-install `use-package`.
|
||||||
|
* Add `prelude-vertico` module. Vertico a simpler alternative to `ivy-mode` and supersedes Selectrum.
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ modules visit the [docs](modules/index.md).
|
||||||
|
|
||||||
;; (require 'prelude-ido) ;; Supercharges Emacs completion for C-x C-f and more
|
;; (require 'prelude-ido) ;; Supercharges Emacs completion for C-x C-f and more
|
||||||
(require 'prelude-ivy) ;; A mighty modern alternative to ido
|
(require 'prelude-ivy) ;; A mighty modern alternative to ido
|
||||||
;; (require 'prelude-selectrum) ;; A powerful, yet simple, alternative to ivy
|
;; (require 'prelude-vertico) ;; A powerful, yet simple, alternative to ivy
|
||||||
;; (require 'prelude-helm) ;; Interface for narrowing and search
|
;; (require 'prelude-helm) ;; Interface for narrowing and search
|
||||||
;; (require 'prelude-helm-everywhere) ;; Enable Helm everywhere
|
;; (require 'prelude-helm-everywhere) ;; Enable Helm everywhere
|
||||||
(require 'prelude-company)
|
(require 'prelude-company)
|
||||||
|
|
|
@ -100,3 +100,4 @@ The following programming languages have enhanced support in Prelude:
|
||||||
- key-chord
|
- key-chord
|
||||||
- Org Mode
|
- Org Mode
|
||||||
- selectrum
|
- selectrum
|
||||||
|
- vertico
|
||||||
|
|
124
modules/prelude-vertico.el
Normal file
124
modules/prelude-vertico.el
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
;;; prelude-vertico.el --- Vertico setup
|
||||||
|
;;
|
||||||
|
;; Copyright © 2011-2023 Bozhidar Batsov
|
||||||
|
;;
|
||||||
|
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
|
||||||
|
;; URL: https://github.com/bbatsov/prelude
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Vertico-related config. Vertico is a smart framework for minibuffer
|
||||||
|
;; completion/filtering/selection (think of ivy/ido).
|
||||||
|
|
||||||
|
;;; License:
|
||||||
|
|
||||||
|
;; This program is free software; you can redistribute it and/or
|
||||||
|
;; modify it under the terms of the GNU General Public License
|
||||||
|
;; as published by the Free Software Foundation; either version 3
|
||||||
|
;; of the License, or (at your option) any later version.
|
||||||
|
;;
|
||||||
|
;; This program is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;; GNU General Public License for more details.
|
||||||
|
;;
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
||||||
|
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
;; Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
;; Enable vertico
|
||||||
|
(use-package vertico
|
||||||
|
:ensure t
|
||||||
|
:init
|
||||||
|
(vertico-mode)
|
||||||
|
|
||||||
|
;; Different scroll margin
|
||||||
|
;; (setq vertico-scroll-margin 0)
|
||||||
|
|
||||||
|
;; Show more candidates
|
||||||
|
;; (setq vertico-count 20)
|
||||||
|
|
||||||
|
;; Grow and shrink the Vertico minibuffer
|
||||||
|
;; (setq vertico-resize t)
|
||||||
|
|
||||||
|
;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
|
||||||
|
;; (setq vertico-cycle t)
|
||||||
|
)
|
||||||
|
|
||||||
|
;; A few more useful configurations for Vertico
|
||||||
|
(use-package emacs
|
||||||
|
:init
|
||||||
|
;; Add prompt indicator to `completing-read-multiple'.
|
||||||
|
;; We display [CRM<separator>], 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)
|
||||||
|
|
||||||
|
;; Emacs 28: Hide commands in M-x which do not work in the current mode.
|
||||||
|
;; Vertico commands are hidden in normal buffers.
|
||||||
|
;; (setq read-extended-command-predicate
|
||||||
|
;; #'command-completion-default-include-p)
|
||||||
|
|
||||||
|
;; Enable recursive minibuffers
|
||||||
|
(setq enable-recursive-minibuffers t))
|
||||||
|
|
||||||
|
;; use the `orderless' completion style.
|
||||||
|
(use-package orderless
|
||||||
|
:ensure t
|
||||||
|
:init
|
||||||
|
;; Configure a custom style dispatcher (see the Consult wiki)
|
||||||
|
;; (setq orderless-style-dispatchers '(+orderless-dispatch)
|
||||||
|
;; orderless-component-separator #'orderless-escapable-split-on-space)
|
||||||
|
(setq completion-styles '(orderless basic)
|
||||||
|
completion-category-defaults nil
|
||||||
|
completion-category-overrides '((file (styles partial-completion)))))
|
||||||
|
|
||||||
|
(use-package consult
|
||||||
|
:ensure t
|
||||||
|
:bind (
|
||||||
|
;; C-x bindings (ctl-x-map)
|
||||||
|
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
|
||||||
|
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
|
||||||
|
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
|
||||||
|
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
|
||||||
|
;; Custom M-# bindings for fast register access
|
||||||
|
("M-#" . consult-register-load)
|
||||||
|
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
|
||||||
|
("C-M-#" . consult-register)
|
||||||
|
;; Other custom bindings
|
||||||
|
("M-y" . consult-yank-pop) ;; orig. yank-pop
|
||||||
|
("<help> a" . consult-apropos) ;; orig. apropos-command
|
||||||
|
;; M-g bindings (goto-map)
|
||||||
|
("M-g e" . consult-compile-error)
|
||||||
|
("M-g f" . consult-flycheck)
|
||||||
|
("M-g g" . consult-goto-line) ;; orig. goto-line
|
||||||
|
("M-g M-g" . consult-goto-line) ;; orig. goto-line
|
||||||
|
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
|
||||||
|
("M-g m" . consult-mark)
|
||||||
|
("M-g k" . consult-global-mark)
|
||||||
|
("M-g i" . consult-imenu)
|
||||||
|
("M-g I" . consult-imenu-multi)
|
||||||
|
;; M-s bindings (search-map)
|
||||||
|
("M-s f" . consult-find)
|
||||||
|
("M-s F" . consult-locate)
|
||||||
|
("M-s g" . consult-grep)
|
||||||
|
("M-s G" . consult-git-grep)
|
||||||
|
("M-s r" . consult-ripgrep)
|
||||||
|
("M-s l" . consult-line)
|
||||||
|
("M-s L" . consult-line-multi)
|
||||||
|
("M-s m" . consult-multi-occur)
|
||||||
|
("M-s k" . consult-keep-lines)
|
||||||
|
("M-s u" . consult-focus-lines)))
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
;; (require 'prelude-ido) ;; Supercharges Emacs completion for C-x C-f and more
|
;; (require 'prelude-ido) ;; Supercharges Emacs completion for C-x C-f and more
|
||||||
(require 'prelude-ivy) ;; A mighty modern alternative to ido
|
(require 'prelude-ivy) ;; A mighty modern alternative to ido
|
||||||
;; (require 'prelude-selectrum) ;; A powerful, yet simple, alternative to ivy
|
;; (require 'prelude-vertico) ;; A powerful, yet simple, alternative to ivy
|
||||||
;; (require 'prelude-helm) ;; Interface for narrowing and search
|
;; (require 'prelude-helm) ;; Interface for narrowing and search
|
||||||
;; (require 'prelude-helm-everywhere) ;; Enable Helm everywhere
|
;; (require 'prelude-helm-everywhere) ;; Enable Helm everywhere
|
||||||
(require 'prelude-company)
|
(require 'prelude-company)
|
||||||
|
|
Loading…
Reference in a new issue