aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/lisp/init-corfu.el
blob: 9acf9d7bfd690d8ef8791b772f8723948139bf5d (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
26
;; -*- lexical-binding: t; -*-

(when (gx/maybe-require-package 'corfu)
  (add-hook 'gdscript-mode-hook #'gx/enable-corfu-only-in-gui)
  (add-hook 'ledger-mode-hook #'gx/enable-corfu-only-in-gui)
  (add-hook 'prog-mode-hook #'gx/enable-corfu-only-in-gui))

(defun gx/enable-corfu-only-in-gui ()
  "Enable Corfu Only In GUI mode."
  (when (display-graphic-p)
    (corfu-mode)))

(setq corfu-cycle t
      corfu-auto t
      corfu-quit-no-match t
      corfu-preselect-first nil
      corfu-auto-prefix 1
      corfu-auto-delay 0.01)

(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))

(provide 'init-corfu)