forked from FG42/FG42
1
0
Fork 0

Setup corfu indexed to work similar to company mode

This commit is contained in:
Sameer Rahmani 2024-04-30 15:01:57 +01:00
parent e67e3fbe1f
commit a5305dec8b
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
2 changed files with 38 additions and 10 deletions

View File

@ -29,7 +29,10 @@ let
optionals (cfg.backend == "corfu") [
corfu
cape
] ++ optionals (cfg.backend == "company") [
] ++ optionals (config.fg42.graphics.enable && cfg.backend == "corfu") [
nerd-icons-corfu
]
++ optionals (cfg.backend == "company") [
company
company-box
]);

View File

@ -63,16 +63,41 @@ The current candidates are shown in a popup below or above the point. The candid
can be selected by moving up and down. Corfu is the minimalistic in-buffer completion
counterpart of the Vertico minibuffer UI."
:custom
(corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
(corfu-auto t) ;; Enable auto completion
(corfu-separator ?\s) ;; Orderless field separator
(corfu-quit-at-boundary nil) ;; Never quit at completion boundary
;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match
(corfu-preview-current nil) ;; Disable current candidate preview
(corfu-preselect 'prompt) ;; Preselect the prompt
(corfu-on-exact-match nil) ;; Configure handling of exact matches
(corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
(corfu-auto t) ;; Enable auto completion
(corfu-separator ?*) ;; Orderless field separator
(corfu-quit-no-match 'separator)
(corfu-quit-at-boundary 'separator)
(corfu-quit-no-match t)
(corfu-preview-current 'insert) ;; Disable current candidate preview
(corfu-preselect 'first) ;; Preselect the prompt
(corfu-on-exact-match 'insert) ;; Configure handling of exact matches
(corfu-scroll-margin 5) ;; Use scroll margin
:hook (emacs-startup . global-corfu-mode)))
(corfu-left-margin-width 2.0)
(corfu-right-margin-width 2.0)
:bind
(:map corfu-map ("<escape>" . corfu-quit))
(:map corfu-map ("M-SPC" . corfu-insert-separator))
:hook
(emacs-startup . global-corfu-mode)
(corfu-mode . (lambda ()
(require 'corfu-popupinfo)
(require 'corfu-indexed)
(corfu-popupinfo-mode)
(corfu-indexed-mode)
(dotimes (i 10)
(define-key corfu-mode-map
(kbd (format "M-%s" i))
(kbd (format "C-%s <tab>" i)))))))
(with-config "graphics"
(use! nerd-icons-corfu
"Nerd icon integration with corfu."
:after corfu
:config
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))))
;;;###autoload