aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/lisp/init-corfu.el
blob: fb92857b14941a06b2fd02b5d55b4fba685a5e22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
;; -*- lexical-binding: t; -*-

(when (gx/maybe-require-package 'corfu)
  (autoload 'corfu-mode "corfu")
  (when (display-graphic-p)
    (add-hook 'prog-mode-hook #'corfu-mode)))

(setq corfu-cycle t
      corfu-auto t
      corfu-quit-no-match t
      corfu-preselect-first nil)

(with-eval-after-load 'corfu
  (define-key corfu-map (kbd "TAB") 'corfu-next)
  (define-key corfu-map (kbd "<tab>") 'corfu-next)
  (define-key corfu-map (kbd "S-TAB") 'corfu-previous)
  (define-key corfu-map (kbd "<backtab>") 'corfu-previous))

(when (gx/maybe-require-package 'orderless)
  (setq completion-styles '(orderless)
        completion-category-defaults nil
        completion-category-overrides
        '((file (styles . (partial-completion))))))

(provide 'init-corfu)