Add some corfu extensions
This commit is contained in:
parent
57288a4d90
commit
6efcee4e88
|
@ -130,16 +130,40 @@ no words in between, beginning with the first word."
|
|||
|
||||
;; code completion - corfu
|
||||
(use-package corfu
|
||||
;; Optional customizations
|
||||
:straight (corfu :files (:defaults "extensions/*")
|
||||
:includes (corfu-indexed corfu-quick corfu-history corfu-info))
|
||||
:custom
|
||||
(corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
|
||||
(corfu-cycle t)
|
||||
:bind (:map corfu-map
|
||||
("TAB" . corfu-next)
|
||||
([tab] . corfu-next)
|
||||
("S-TAB" . corfu-previous)
|
||||
([backtab] . corfu-previous))
|
||||
("TAB" . corfu-next)
|
||||
([tab] . corfu-next)
|
||||
("S-TAB" . corfu-previous)
|
||||
([backtab] . corfu-previous))
|
||||
:hook (emacs-startup . global-corfu-mode))
|
||||
|
||||
(defmacro use-extension (pkg name &rest args)
|
||||
"Like `use-package', but for a package extension.
|
||||
`PKG' is the name of the package, `NAME' and `ARGS' are as with `use-package'"
|
||||
(declare (indent defun))
|
||||
`(use-package ,name
|
||||
:straight nil
|
||||
:after pkg
|
||||
:demand t
|
||||
,@args))
|
||||
|
||||
(use-extension corfu corfu-indexed
|
||||
:config (corfu-indexed-mode 1))
|
||||
|
||||
(use-extension corfu corfu-quick
|
||||
:bind (:map corfu-map
|
||||
("C-;" . corfu-quick-insert)
|
||||
("C-'" . corfu-quick-exit)))
|
||||
|
||||
(use-extension corfu corfu-history
|
||||
:config
|
||||
(corfu-history-mode 1)
|
||||
(add-to-list 'savehist-additional-variables 'corfu-history))
|
||||
|
||||
(use-package corfu-doc
|
||||
:hook
|
||||
(corfu-mode . corfu-doc-mode))
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
(propertize "» " 'face 'vertico-current)
|
||||
" ")
|
||||
cand)))
|
||||
|
||||
(defun define-vertico-key (key &rest defs)
|
||||
"Define KEY conditionally in the vertico keymap.
|
||||
DEFS is a plist associating completion categories to commands."
|
||||
|
@ -147,14 +148,10 @@ DEFS is a plist associating completion categories to commands."
|
|||
:config
|
||||
(add-to-list 'savehist-additional-variables 'vertico-repeat-history))
|
||||
|
||||
(use-feature vertico-indexed
|
||||
:after vertico
|
||||
:demand t
|
||||
(use-extension vertico vertico-indexed
|
||||
:config (vertico-indexed-mode 1))
|
||||
|
||||
(use-feature vertico-quick
|
||||
:after vertico
|
||||
:demand t
|
||||
(use-extension vertico vertico-quick
|
||||
:bind (:map vertico-map
|
||||
("C-;" . vertico-quick-insert)
|
||||
("C-'" . vertico-quick-exit)))
|
||||
|
|
Loading…
Reference in New Issue